Show Posts
Pages: 1 [2]
16  Using Arduino / Programming Questions / Would I use analogRead to incorporate a joystick? on: December 30, 2012, 01:08:22 pm
I know it sounds like a stupid question but I'm new.
 
I'm trying to use a N64 controllers joystick to trigger a dc motor.

I'm not exactly sure where to begin and if someone could give me a little example or point me in the right direction I would really appreciate it.
17  Using Arduino / Programming Questions / Re: I'm not exactly sure how to put this...I'm new to this on: December 30, 2012, 01:34:45 am
how would i do that with strings? or would i have do each and led individually?
18  Using Arduino / Programming Questions / Re: I'm not exactly sure how to put this...I'm new to this on: December 30, 2012, 01:22:43 am
As i said i am very new to this, but that is all the code i have, it compiles and uploads, what am i missing?... and my goal is to have each LED blink with each note in sync, right now it alternates between a note and blink.

I tried to shortcut it and don't exactly know what I'm doing. One thing that would help is if you could explain how I could get one LED to blink at the same time as the tone and I could probably figure it out from there.
19  Using Arduino / Programming Questions / **UPDATE** PROBLEM SOLVED on: December 30, 2012, 12:28:13 am
Thanks for the help but just needed to take a break from it and come back.


Ok I'm new to Arduino and programming in general, but i am capable and really interested in electronics and really want to learn.

So I'm staring off trying to make a little thing that plays this->http://arduino.cc/en/Tutorial/Tone melody and have a separate LED blink for each note after a button is pushed.



I understand all the wiring and had it set up to play the melody on the button push but im having trouble getting the LEDS to sync with the notes, could someone please help me with this:



Code:
#include "pitches.h"
int button = 2;
int led1 = 13;
int led2 = 12;
int led3 = 11;
int led4 = 10;

int speaker = 8;
int melody[] = {
  NOTE_C4, NOTE_G3,NOTE_G3, NOTE_A3, NOTE_G3,0, NOTE_B3, NOTE_C4};
int noteDurations[] = {
  4, 8, 8, 4,4,4,4,4 };
  
int ledsequence[] = {
  led1, led2, led2, led3, led2, led4, led1};


void setup() {
  Serial.begin(9600);
  pinMode(button, INPUT_PULLUP);
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
  pinMode(speaker, OUTPUT);
}
 void loop()
 {
  int state = digitalRead(button);
  Serial.println(state);
  delay(5);

  
  if (state == 0)
  {
    for (int thisNote = 0; thisNote < 8; thisNote++) {
    
    int noteDuration = 1000/noteDurations[thisNote];
    
    int pauseBetweenNotes = noteDuration * 1.30;
    
    digitalWrite(ledsequence[thisNote],HIGH);
    
    delay(noteDuration);
  
    digitalWrite(ledsequence[thisNote],LOW);
    
    delay(pauseBetweenNotes);
            
    tone(8, melody[thisNote],noteDuration);

    delay(pauseBetweenNotes);
    
    }
  }
}
20  Using Arduino / Installation & Troubleshooting / Re: Drivers wont install on: December 26, 2012, 03:06:18 pm
So i got the same problem as the other guy, does that download solve the problem of the device drivers not being signed by the publisher?
Pages: 1 [2]