Loading...
Pages: 1 [2]   Go Down
Author Topic: to many arguments to function  (Read 285 times)
0 Members and 1 Guest are viewing this topic.
Beijing
Offline Offline
Full Member
***
Karma: 3
Posts: 181
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
Online Online
Edison Member
*
Karma: 29
Posts: 1568
"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

UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino

Arduino Tutorials, coming soon.

"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown

Portugal
Offline Offline
God Member
*****
Karma: 9
Posts: 753
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
Online Online
Edison Member
*
Karma: 29
Posts: 1568
"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

UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino

Arduino Tutorials, coming soon.

"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown

Pages: 1 [2]   Go Up
Print
 
Jump to: