Pages: 1 [2]   Go Down
Author Topic: to many arguments to function  (Read 799 times)
0 Members and 1 Guest are viewing this topic.
Beijing
Offline Offline
Full Member
***
Karma: 3
Posts: 193
Skype name habib.derbyshire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

So what can I do?
Logged

What is man's best friend? The breadboard!

Queens, New York
Offline Offline
Faraday Member
**
Karma: 67
Posts: 2943
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Try this to start
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Portugal
Offline Offline
Edison Member
*
Karma: 28
Posts: 1434
Tomorrow I will know a BIT more than yesterday
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
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 ?
Logged

Debian,Mint,Ubuntu
Arduino Mega 2560
Arduino Nano
Arduino Duemilanove
MAC OS Montain Lion
Raspberry PI Model B


Queens, New York
Offline Offline
Faraday Member
**
Karma: 67
Posts: 2943
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
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:
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.
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Pages: 1 [2]   Go Up
Jump to: