Show Posts
Pages: [1]
1  Products / The Arduino Starter Kit / A Tip: Buttons, Potentiometers and Tilt Sensors . . . on: January 05, 2013, 11:29:18 pm
. . . Oh My.  smiley-razz

I'm 50 and have been in to some simple electronics for a few years now and I'm having a blast with this Arduino Starter Kit. I want to start a fund to buy one for every 6th grader at my kids elementary school and start an after school club!

That said, here's a tip that has helped me get more enjoyment out of this kit. For all the objects in the Subject line I've soldered mail header pins to the pins of these components. They all either kept popping out of the breadboard or wouldn't go in at all and soldering header pins on to them locks them in solid whenever I used them and they still pop right out. To do this I used the header pins that came with the kit and one of those helping hand vises. In the case of the potentiometer I broke off three male header pins from the strip and pulled out the middle pin keeping the other two held in place by the plastic. So now they are spaced correctly I put one of the pins from the pot in the vise (roach clip is what we called them back in the day) and then in a hand twisting move put one of the two pins in the vise with it. I then soldered the two together and repeated the operation on the other pins. This left me with one side of the pot that had the two pins held together by the plastic holder so their width would always be right and the third pin was soldered to the header pin I pulled out of the middle of the three.

Hope that makes sense. I've attached a picture of the finished product if that helps at all.

All the best,

Dennis

2  Products / The Arduino Starter Kit / Project 07 Keyboard Instrument on: December 31, 2012, 07:31:21 pm
Having a blast with my new Starter Kit. I'm up to project 07 and I'm having an array problem and a logic problem as well. I've pasted the code as shown in the book at the end of this post. Two problems
PROBLEM 1
1st if I check this code it tells me an error on line 4:
Code:
"conflicting declaration 'int buttons [0]'"
'buttons' has a previous declaration as 'int buttons [6]'"

So it doesn't like my int buttons[0] = 2; statement. I've tried losing the int and changing = to == both to no avail. If I comment out this line it compiles fine loads and only the second button plays a note.

PROBLEM 2
I don't see what buttons does after this. I thought it would be used to check the 4 physical buttons on the breadboard but those are the only two places it is referenced in the code. Seems like something is missing with this array.

Any help appreciated.

Dennis
------------begin code this is the complete source ---------
Code:
int buttons[6];
// set up an array with 6 integers

int buttons[0] = 2;
// give the first element of the array the value 2 note that it counts from zero

int notes[] = {262, 294, 330, 349};
//corresponds to the notes C, D, E and F

void setup() {
  Serial.begin(9600);
}

void loop () {
  int keyVal = analogRead(A0);
  Serial.println(keyVal);
  
  if (keyVal == 1023){
    tone(8, notes[0]);
  }
  else if (keyVal >= 990 && keyVal <= 1010) {
    tone(8, notes[1]);
  }
  else if(keyVal >= 505 && keyVal <= 515) {
    tone(8, notes[2]);
  }
  else if(keyVal >= 5 && keyVal <= 10) {
    tone(8, notes[3]);
  }
  else{
    noTone(8);
  }
}

Moderator edit: error message rendered legible
Pages: [1]