Serial Monitor Problems

For makers who have purchased an Adafruit Starter Pack, get help with the tutorials here!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
rarehansolo
 
Posts: 4
Joined: Sun Jan 18, 2015 9:44 pm

Serial Monitor Problems

Post by rarehansolo »

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.
018.jpg
018.jpg (58.33 KiB) Viewed 1408 times

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Serial Monitor Problems

Post by Franklin97355 »

Could you post the code you are running and what you have connected to the Arduino?

User avatar
rarehansolo
 
Posts: 4
Joined: Sun Jan 18, 2015 9:44 pm

Re: Serial Monitor Problems

Post by rarehansolo »

This is the code im using

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);
}
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.
Last edited by rarehansolo on Sun Jan 18, 2015 11:21 pm, edited 2 times in total.

User avatar
rarehansolo
 
Posts: 4
Joined: Sun Jan 18, 2015 9:44 pm

Re: Serial Monitor Problems

Post by rarehansolo »

It is still not working.

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Serial Monitor Problems

Post by Franklin97355 »

And if you run lesson 4 it works correctly? Could you post a closer picture of the breadboard so I can see the connections?

User avatar
rarehansolo
 
Posts: 4
Joined: Sun Jan 18, 2015 9:44 pm

Re: Serial Monitor Problems

Post by rarehansolo »

Well when i try the code for lesson 4 it dose not work ethier.
021.jpg
021.jpg (156.46 KiB) Viewed 1380 times

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Serial Monitor Problems

Post by Franklin97355 »

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?

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Starter Pack”