We ordered IR sensors, an additional Arduino, an Arduino DotStar LED strip, 2 Xbees, 2 Xbee shields, and 2 external batteries.
At this stage, I tried to connect two Arduinos so they can communicate with each other, and one of them can control a single LED bulb, before I learned to code the DotStar LED strip.
I have two major problem at this stage. First, my computer was not recognizing the Xbees so I was unable to configure them, but I found that it is not necessary to solve this problem because all Xbees are able to connect as they came out of factory, and configuration is just to avoid reading information from other Xbees that are not mine. Luckily, we are the only group who is going to use Xbee in this room, so I chose to ignore this problem. The second problem is that I did not know how the connect the DotStar LED strip to Arduino, but I figured it out after reading descriptions on Adafruit’s website and watching some YouTube tutorials.
For commanding Arduino
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.print('H');
delay(500);
Serial.print('L');
delay(500);
}
For Arduino with a single LED bulb
int led=13;
int incomingByte;
void setup() {
Serial.begin(9600);
pinMode(led,OUTPUT);
}
void loop() {
if (Serial.available() > 0) {
incomingByte = Serial.read();
if(incomingByte == 'N'){
digitalWrite(led,LOW);
}
if(incomingByte == 'Y')
digitalWrite(led,HIGH);
}
}
No comments:
Post a Comment