Go Down

Topic: for loops take forever :-D (Read 459 times) previous topic - next topic


So i was playing around with the multiple led code found here http://www.thebox.myzen.co.uk/Workshop/LED_Sensing.html
when I realized this could be done so much better with direct port manipulation :)

only thing that I am having trouble with is figuring out how to measure how long it takes for each led to discharge.

while ((PIND !=169)||(PINB!=43))
switch PIND
case B10101000:

might end up with a huge case statement


Are you looking for something like this?

Code: [Select]
for (byte i = 0; i<8; i++) {
 if (0 == (PIND & (1<<i))) {
    //  Bit i has dropped to zero...


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131