Go Down

Topic: to many arguments to function (Read 1 time) previous topic - next topic

arduinohabib

What is man's best friend? The breadboard!

HazardsMind

Code: [Select]

    case 0 : zero();
    break;
    case 1 : one();
    break;
    case 2 : two();
    break;


Try this to start
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

HugoPT

Code: [Select]
0b00000000 = all off
0b00101010  = something on
0b00010101 = something else on
.
.
0b11111111 = all on


An array ?
Why not just an uint8_t variable or an int(16 bits) if you need more flags to mark the status pins and eventually set then ON or OFF ?
Debian,Mint,Ubuntu
Arduino Mega 2560
Arduino Nano
Arduino Duemilanove
MAC OS Montain Lion
Raspberry PI Model B

HazardsMind


Code: [Select]
0b00000000 = all off
0b00101010  = something on
0b00010101 = something else on
.
.
0b11111111 = all on


An array ?
Why not just an uint8_t variable or an int(16 bits) if you need more flags to mark the status pins and eventually set then ON or OFF ?


That uses direct port manipulation, to turn on/off each led without the repetitition of,
 
Code: [Select]
digitalWrite(pin_b, OFF);
  digitalWrite(pin_c, OFF);
  digitalWrite(pin_d, OFF);
  digitalWrite(pin_e, OFF);
  digitalWrite(pin_f, OFF);
  digitalWrite(pin_g, OFF);

This is a very long way to do it, and rather unneeded, but as the OP said, it is an old code and already looked into it.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

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!

Arduino
via Egeo 16
Torino, 10131
Italy