Hi all,
My intended project is for an infrared remote control over a stepper motor which is connected to a 6 Gang log pot for a six channel amp, the amp is not my project it's on of my friends, but we were talking and it cropped up somewhere and I thought I'd give it a shot.
I was looking around for IR tutorials and there is a lot of code I don't understand so I wrote my own code for how I thought I could get the remote part of it working and not the decoder.
Eventually I would like to have two arduinos, one with the buttons and the IR pulser and one with the task of decoding the IR pulses and then turning them into stepper motor motion.
So here goes,
int button = 13; // button
int button2 = 12; // button2
int irLED = 9; // IR LED
int val = 0;
int val2 = 0;void setup()
{
pinMode(button, INPUT); // button
pinMode(button2, INPUT); //button2
pinMode(irLED, OUTPUT); //irLED
}void loop()
{
val = digitalRead(button);
if (val == HIGH); {
digitalWrite(irLED, HIGH);
delay(200);
digitalWrite(irLED, LOW);
delay(200);
digitalWrite(irLED, HIGH);
delay(200);
digitalWrite(irLED, LOW);
}val2 = digitalRead(button2);
if (va2l == HIGH); {
digitalWrite(irLED, HIGH);
delay(200);
digitalWrite(irLED, LOW);
delay(200);}
The code is quite simple so you should know where I'm going with it.
What my questions are is, 1) Is this approach workable? Or am I going around it in the totally hamfisted way?
- What kind of code could I look at for the receiver providing the code I wrote above would work at all.
I know there are better ways to read buttons but I just wrote this off my head to put here and ask you guys so I'll probably incorporate that later.
Also, my friend with the amp would like to know how to drive one of these http://www.st.com/stonline/products/literature/ds/9227.pdf if it is at all possible with the Arduino?
I'm not asking you to write my code for me at all, I just want telling whether or not I should be taking this route, and I'm asking for some links to either tutorials or libraries I should be looking at. Thank you very much,
Aaron.