Show Posts
Pages: 1 2 3 [4] 5 6 ... 14
46  Using Arduino / Programming Questions / Re: to many arguments to function on: January 29, 2013, 10:05:28 am
PS it used to compile
47  Using Arduino / Programming Questions / Re: to many arguments to function on: January 29, 2013, 10:03:11 am
All right, this is the full code:
Code:
#include"sevenseg.h"
int val=0;
void setup(){
  sevensegpins(13, 12, 11, 10, 9, 8, 7);
  common_cathode(true);
}
void loop(){
  val=(analogRead(0));
  val=map(val, 0, 1023, 0, 9);
  sevenseg(val);
}
and also
Code:
#include<Arduino.h>
int pin_a;
int pin_b;
int pin_c;
int pin_d;
int pin_e;
int pin_f;
int pin_g;
int ON;
int OFF;
void sevensegpins(int a, int b, int c, int d, int e, int f, int g){
  pin_a=a;
  pin_b=b;
  pin_c=c;
  pin_d=d;
  pin_e=e;
  pin_f=f;
  pin_g=g;
  pinMode(pin_a, OUTPUT);
  pinMode(pin_b, OUTPUT);
  pinMode(pin_c, OUTPUT);
  pinMode(pin_d, OUTPUT);
  pinMode(pin_e, OUTPUT);
  pinMode(pin_f, OUTPUT);
  pinMode(pin_g, OUTPUT);
}
void common_cathode(boolean cathode){
  if(cathode==true){
    ON=HIGH;
    OFF=LOW;
  }
  else{
    ON=LOW;
    OFF=HIGH;
  }
}
void clearall(){
  digitalWrite(pin_a, OFF);
  digitalWrite(pin_b, OFF);
  digitalWrite(pin_c, OFF);
  digitalWrite(pin_d, OFF);
  digitalWrite(pin_e, OFF);
  digitalWrite(pin_f, OFF);
  digitalWrite(pin_g, OFF);
}
void zero(){
  clearall();
  digitalWrite(pin_a, ON);
  digitalWrite(pin_d, ON);
  digitalWrite(pin_f, ON);
  digitalWrite(pin_e, ON);
  digitalWrite(pin_b, ON);
  digitalWrite(pin_c, ON);
}
void one(){
  clearall();
  digitalWrite(pin_b, ON);
  digitalWrite(pin_c, ON);
}
void two(){
  clearall();
  digitalWrite(pin_a, ON);
  digitalWrite(pin_b, ON);
  digitalWrite(pin_g, ON);
  digitalWrite(pin_e, ON);
  digitalWrite(pin_d, ON);
}
void three(){
  clearall();
  digitalWrite(pin_a, ON);
  digitalWrite(pin_b, ON);
  digitalWrite(pin_g, ON);
  digitalWrite(pin_c, ON);
  digitalWrite(pin_d, ON);
}
void four(){
  clearall();
  digitalWrite(pin_f, ON);
  digitalWrite(pin_g, ON);
  digitalWrite(pin_b, ON);
  digitalWrite(pin_c, ON);
}
void five(){
  clearall();
  digitalWrite(pin_a, ON);
  digitalWrite(pin_f, ON);
  digitalWrite(pin_g, ON);
  digitalWrite(pin_c, ON);
  digitalWrite(pin_d, ON);
}
void six(){
  clearall();
  digitalWrite(pin_a, ON);
  digitalWrite(pin_f, ON);
  digitalWrite(pin_e, ON);
  digitalWrite(pin_g, ON);
  digitalWrite(pin_c, ON);
  digitalWrite(pin_d, ON);
}
void seven(){
  clearall();
  digitalWrite(pin_a, ON);
  digitalWrite(pin_b, ON);
  digitalWrite(pin_c, ON);
}
void eight(){
  clearall();
  digitalWrite(pin_a, ON);
  digitalWrite(pin_b, ON);
  digitalWrite(pin_c, ON);
  digitalWrite(pin_d, ON);
  digitalWrite(pin_e, ON);
  digitalWrite(pin_f, ON);
  digitalWrite(pin_g, ON);
}
void nine(){
  clearall();
  digitalWrite(pin_a, ON);
  digitalWrite(pin_f, ON);
  digitalWrite(pin_g, ON);
  digitalWrite(pin_b, ON);
  digitalWrite(pin_c, ON);
  digitalWrite(pin_d, ON);
}
void lettera(){
  clearall();
  digitalWrite(pin_a, ON);
  digitalWrite(pin_b, ON);
  digitalWrite(pin_c, ON);
  digitalWrite(pin_e, ON);
  digitalWrite(pin_f, ON);
  digitalWrite(pin_g, ON);
}
void letterb(){
  clearall();
  digitalWrite(pin_e, ON);
  digitalWrite(pin_f, ON);
  digitalWrite(pin_d, ON);
  digitalWrite(pin_c, ON);
  digitalWrite(pin_g, ON);
}
void letterB(){
  clearall();
  digitalWrite(pin_a, ON);
  digitalWrite(pin_b, ON);
  digitalWrite(pin_c, ON);
  digitalWrite(pin_d, ON);
  digitalWrite(pin_e, ON);
  digitalWrite(pin_f, ON);
  digitalWrite(pin_g, ON);
}
void letterc(){
  clearall();
  digitalWrite(pin_d, ON);
  digitalWrite(pin_e, ON);
  digitalWrite(pin_g, ON);
}
void letterC(){
  clearall();
  digitalWrite(pin_a, ON);
  digitalWrite(pin_d, ON);
  digitalWrite(pin_e, ON);
  digitalWrite(pin_f, ON);
}
void letterd(){
  clearall();
  digitalWrite(pin_b, ON);
  digitalWrite(pin_c, ON);
  digitalWrite(pin_d, ON);
  digitalWrite(pin_e, ON);
  digitalWrite(pin_g, ON);
}
void letterD(){
  clearall();
  digitalWrite(pin_a, ON);
  digitalWrite(pin_b, ON);
  digitalWrite(pin_c, ON);
  digitalWrite(pin_d, ON);
  digitalWrite(pin_e, ON);
  digitalWrite(pin_f, ON);
}
void lettere(){
  digitalWrite(pin_a, ON);
  digitalWrite(pin_b, ON);
  digitalWrite(pin_d, ON);
  digitalWrite(pin_e, ON);
  digitalWrite(pin_f, ON);
  digitalWrite(pin_g, ON);
}
void letterE(){
  clearall();
  digitalWrite(pin_a, ON);
  digitalWrite(pin_d, ON);
  digitalWrite(pin_e, ON);
  digitalWrite(pin_f, ON);
  digitalWrite(pin_g, ON);
}
void letterf(){ 
  clearall();
  digitalWrite(pin_a, ON);
  digitalWrite(pin_b, ON);
  digitalWrite(pin_c, ON);
  digitalWrite(pin_g, ON);
  }
void letterh(){
  clearall();
  digitalWrite(pin_c, ON);
  digitalWrite(pin_e, ON);
  digitalWrite(pin_f, ON);
  digitalWrite(pin_g, ON);
}
void letterH(){
  clearall();
  digitalWrite(pin_b, ON);
  digitalWrite(pin_c, ON);
  digitalWrite(pin_g, ON);
  digitalWrite(pin_e, ON);
  digitalWrite(pin_f, ON);
}
void letterl(){
  clearall();
  digitalWrite(pin_e, ON);
  digitalWrite(pin_f, ON);
}
void letterL(){
  clearall();
  digitalWrite(pin_e, ON);
  digitalWrite(pin_f, ON);
  digitalWrite(pin_d, ON);
}
void letterp(){
  clearall();
  digitalWrite(pin_a, ON);
  digitalWrite(pin_b, ON);
  digitalWrite(pin_e, ON);
  digitalWrite(pin_f, ON);
  digitalWrite(pin_g, ON);
}
void letterq(){
  digitalWrite(pin_a, ON);
  digitalWrite(pin_b, ON);
  digitalWrite(pin_c, ON);
  digitalWrite(pin_f, ON);
  digitalWrite(pin_g, ON);
}
void letters(){
  clearall();
  digitalWrite(pin_a, ON);
  digitalWrite(pin_f, ON);
  digitalWrite(pin_g, ON);
  digitalWrite(pin_c, ON);
  digitalWrite(pin_d, ON);
}
void letteru(){
  clearall();
  digitalWrite(pin_b, ON);
  digitalWrite(pin_c, ON);
  digitalWrite(pin_d, ON);
  digitalWrite(pin_e, ON);
  digitalWrite(pin_f, ON);
}
void sevenseg(int val){
  switch(val){
    case'0': zero();
    break;
    case'1': one();
    break;
    case'2': two();
    break;
    case'3': three();
    break;
    case'4': four();
    break;
    case'5': five();
    break;
    case'6': six();
    break;
    case'7': seven();
    break;
    case'8': eight();
    break;
    case'9': nine();
    break;
  }
}
48  Using Arduino / Programming Questions / to many arguments to function on: January 29, 2013, 09:55:53 am
Hi all! I was writing some Arduino seven seg code, and it wouldn't compile, even though there was nothing wrong with the code.
Code:
void sevenseg(int val){
  switch(val){
    case'0': zero();
    break;
    case'1': one();
    break;
    case'2': two();
    break;
    case'3': three();
    break;
    case'4': four();
    break;
    case'5': five();
    break;
    case'6': six();
    break;
    case'7': seven();
    break;
    case'8': eight();
    break;
    case'9': nine();
    break;
  }
}
the error message:
Quote
/sevenseg.h: In function 'void setup()':
sevenseg.h:262: error: too many arguments to function 'void sevenseg(int)'
sketch_jan29a:13: error: at this point in file
Can anyone please tell me what the problem is?
Thanks
Habib
49  Using Arduino / Motors, Mechanics, and Power / Re: Need help: Using PWM on a solenoid for easy release. on: January 29, 2013, 07:24:43 am
Or you can use a big capacitor
50  Using Arduino / Motors, Mechanics, and Power / Re: AC Lamp control on: January 29, 2013, 07:07:07 am
Oh an don't put the diode the wrong way, or you will cause a short circuit.
51  Using Arduino / Motors, Mechanics, and Power / Re: AC Lamp control on: January 29, 2013, 07:05:31 am
You need to post the picture somewhere online. This is where you put a flyback diode, I drew a diagram:
http://www.flickr.com/photos/92382393@N06/8425886519/
52  Community / Local Groups / Anyone in China? on: January 29, 2013, 06:12:47 am
Are there any Arduino users in China? I speak Chinese and English.
53  Community / Local Groups / Re: Philippines on: January 29, 2013, 05:37:37 am
I'm going to Philippines for vacation, which part of Philippines do you live in?
54  Products / The Arduino Starter Kit / Re: When will there be more Arduino Starter kits? on: January 29, 2013, 04:44:06 am
I never had any starter kits, I always go to the local electronic market and buy parts.
55  Community / Gigs and Collaborations / Re: Sparrow/starling trap on: January 29, 2013, 04:41:00 am
Somehow reminds me of Faulty Towers... Basil the Rat... LOL
56  Community / Workshops and Events / Re: PROPOSAL: Arduino Workshops in Manila, Philippines on: January 29, 2013, 04:39:09 am
@Kuya Marc please reply!! I'm getting excited, and we are leaving for Philippines soon!!
57  Using Arduino / Project Guidance / Re: Security System on: January 29, 2013, 04:27:15 am
You can use the Multi-Kamera IR control library, which can controll digital cameras
http://sebastian.setz.name/arduino/my-libraries/multi-camera-ir-control/
or you can hack a camera yourself
58  Using Arduino / Project Guidance / Re: RGB LED Matrix spread over 400 square feet (43 square meters) on: January 29, 2013, 04:18:14 am
If you have enough money, you can use digital pots to fade the leds.
59  Using Arduino / Project Guidance / Re: touch screen system on: January 29, 2013, 04:13:10 am
You should first do some research, find out what you need, the ask questions. You haven't even bothered to do some research. And if you want people to answer questions, be polite. You could've said, I'm sorry, you know how difficult it is to type on a phone, please don't make fun of me, or something like that
60  Using Arduino / Project Guidance / Re: Battery Question on: January 29, 2013, 03:36:22 am
Why  don't you use those rechargable packs ussed in model cars and RC aircraft?
Pages: 1 2 3 [4] 5 6 ... 14