Serial Monitor Problems
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- rarehansolo
- Posts: 4
- Joined: Sun Jan 18, 2015 9:44 pm
Serial Monitor Problems
My Arduino is not doing what the Serial Monitor is telling it to do for lesson 5. All of the connections are right, and i double checked. The lights wont respond when i clear them when i type in x and send it to the Arduino. I also tried the x 0 3 5 and it did not work. can someone please help me with this problem.
- Franklin97355
- Posts: 23910
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Serial Monitor Problems
Could you post the code you are running and what you have connected to the Arduino?
- rarehansolo
- Posts: 4
- Joined: Sun Jan 18, 2015 9:44 pm
Re: Serial Monitor Problems
This is the code im using
Oh and the connector cord im using thats plugged into the Arduino is the one that comes in the starter pack that you plug into the computer.
Code: Select all
/*
Adafruit Arduino - Lesson 5. Serial Monitor
*/
int latchPin = 5;
int clockPin = 6;
int dataPin = 4;
byte leds = 0;
void setup()
{
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
updateShiftRegister();
Serial.begin(9600);
while (! Serial); // Wait untilSerial is ready - Leonardo
Serial.println("Enter LED Number 0 to 7 or 'x' to clear");
}
void loop()
{
if (Serial.available())
{
char ch = Serial.read();
if (ch >= '0' && ch <= '7')
{
int led = ch - '0';
bitSet(leds, led);
updateShiftRegister();
Serial.print("Turned on LED ");
Serial.println(led);
}
if (ch == 'x')
{
leds = 0;
updateShiftRegister();
Serial.println("Cleared");
}
}
}
void updateShiftRegister()
{
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, leds);
digitalWrite(latchPin, HIGH);
}
Last edited by rarehansolo on Sun Jan 18, 2015 11:21 pm, edited 2 times in total.
- rarehansolo
- Posts: 4
- Joined: Sun Jan 18, 2015 9:44 pm
Re: Serial Monitor Problems
It is still not working.
- Franklin97355
- Posts: 23910
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Serial Monitor Problems
And if you run lesson 4 it works correctly? Could you post a closer picture of the breadboard so I can see the connections?
- rarehansolo
- Posts: 4
- Joined: Sun Jan 18, 2015 9:44 pm
Re: Serial Monitor Problems
Well when i try the code for lesson 4 it dose not work ethier.
- Franklin97355
- Posts: 23910
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Serial Monitor Problems
Then start from the begining and see where the process breaks. Check your cables, jumpers and the chip to make sure everything is wired correctly. Can you take a picture straight down so I can see where the wires go on the chip?
Please be positive and constructive with your questions and comments.