You're so close! Let's jump to what's correct first. In your second while True block, your code already sleeps (waits) for an interval before continuing. Here it is with some comments and formatting corrections: while True: # this reads from your GPIO to set a variable Current_State = GPIO.input(GPIO_PIR) #...

First thing, I must agree it is duplicate. But things have changed since 2010, and now it is possible to control this LED ! Take a look at xline. It's a project of mine, and it' s able to control the LED, through the SMC. Just take a look at...

First, you shoud put mask = mask>>1 in the end of loop. Second, you need to replace the if( (LED[num_2] & mask) == 1 ) with if( (LED[num_2] & mask) == mask) or just if( LED[num_2] & mask ) Mask could be 0b10000000, 0b01000000,...,0b00000001. The result of & operation can...

It is better to convert hsv colour space if you are doing colour based segmentation, as it doesn’t affect the brightness and light variation, You could use the color range like cvtColor(src, hsv, CV_BGR2HSV); inRange(hsv,Scalar(0,50,40), Scalar(10,255,255),thr1); //upper red range of hue cylinder inRange(hsv,Scalar(165,50,40), Scalar(179,255,255),thr2);// lower red range of hue cylinder...

I think is a "too short" loop. Using a double while to catch an input causes that both IF can be valid thousand of times until you release the pushbutton. A suggest you to manage it on the release of button, that means you trigger the push of button and...

The most usable and user friendly solution is to ignore the fact that your most significant digit is capable of displaying up to 9 and simply multiply by 10000 unless you desperately need the maxim resolution in which case simply use a scale factor of 100000 and document that your...

Figured out the problem - the font wasn't even assigning! When I called: regFont = new Font(familyName, 6,FontStyle.Regular, GraphicsUnit.Pixel); It didn't change! Like, if you went through in the debugger, the value didn't change after the assignment. So weird. but when I changed the InitFont method to say: void InitFont()...

Hi all thank you very much for the help. I've ended up fixing it. See below: " The memory was okay. I think you were right that the clock speeds are different for the arduino and the attiny. I ended up using the libraries found here: https://github.com/cpldcpu/light_ws2812 Then I loaded...

You could try using a state variable. Declare a boolean variable such as: boolean runSequence = false; Now, when you detect a button press, just toggle the state: // Replace this condition to whatever matches your button setup if ( digitalRead(pin) == HIGH ) { runSequence = !runSequence; } Then,...

input_state = GPIO.input(10) and if input_state == False: should be at the same level of indentation, which is exactly what the error message is saying. There is no reason to indent the second line (since the previous one doesn't open a new block, so indenting it is an error). ...

Besides that you are blocking the UI with your blinking() method, you're not drawing correctly anyway. You should only draw when handling a Paint event. Also, there's not really a good reason to use a PictureBox if all you're going to do is draw something yourself. Just put a Panel,...

It is done by bit masking. If you want to check whether or not an i'th bit of a is 1 you will do something like this: if (a & (1 << i)) { // Do something } This way all of the bits of a except the i'th one...

The unary ~ operator changes the bits of the whole int, not only the lower 8 bits. ~0xfeu (equivalently, ~0x00feu) is 0xff01u for 16-bit int. I suggest to always use unsigned types when doing bit manipulation, passing a negative int to %X is, strictly speaking, undefined behavior. To get rid...

Once your Pin is set logically HIGH, it will serve the specified voltage (probably 5V) and the current that is needed (limited by the board). Thus, you do not have any influence on these ouptput parameters. You might consider switching the LED on and off with a sufficiently high frequency,...

It looks like the problem is in the delay(5000) the micro-controller will wait 5 seconds between a sample of the button's state. if you remove the delay statement it should be on and off instantly. you should try to trigger the setRemoteState only on state change, so it will not...

First, in setup: pinMode(buttonPin , INPUT); Second, what are you expected when setting==3? You aren't reloading/updating the variables for brightR brightG brightB. So, when you change setting, you will lost the change of brightness...

Sounds like you have 3 logical blocks: Individual LED control Master LED control Monitor-LED indicator control Decouple your code into functions, let's name them checkIndividualButton, checkMasterButton and updateMonitorLed, one for each logical block, and call them from your main loop import RPi.GPIO as GPIO import time # our 3 functions...

You don't set the DDRs to output anywhere. The pins you want to use as outputs must have the corresponding bit in DDRx set to 1. Otherwise it remains an input pin. An input pin will show an output, but with a lower current and a more slowly rising edge....

First of all this is not a software question. When it comes to your problem, 2 pinned LEDs don't work the way 4 pinned ones work. If you are using an LED with 2 pins, you give them a voltage and wait for them to change their color with time....

The least significant bit of TRISC indicates whether RC0 is an input or an output. In your code you are setting it to 1, which is an input. The mnemonic is 1 looks like an I (input) and 0 looks like an O (output). Also with this type of problem...