Serial Monitor

I'm trying to learn how to use the Serial Monitor I want to throw in some commands just for the fun of it to turn on and off a led. I used the Digital Read Serial that came with the program and its not working. I have the Serial set to 9600 and the push button set to 0 which is the normal for me. I uploaded the code onto my attiny85 threw arduino uno make edition. and its not working.

Any thoughts on what I am doing wrong here?.

You aren't showing us the sketch.

Sorry about that, Here is the sketch. I have the monitor set at 9600 with no line ending and when I type 1, 0 or 102 all i get a y symbol.

void setup(){
Serial.begin(9600);
}

void loop(){
while (Serial.available()==0);

int val = Serial.read() - '0';

if (val == 1)
{
Serial.println("Led is On");
}
else if (val == 0)
{
Serial.println("Led is Off");
}
else if(val == 102)
{
Serial.println("Hello world");
}
else
{
Serial.println("Invalid");
}
Serial.flush();
}

Put your code in CODE tags

void setup(){
	Serial.begin(9600);
}

void loop(){
	while (Serial.available()==0);

	int val = Serial.read() - '0';

	if (val == 1)
	{
		Serial.println("Led is On");
	}
	else if (val == 0)
	{
		Serial.println("Led is Off");
	}
	else if(val == 102)
	{
		Serial.println("Hello world");
	}
	else
	{
		Serial.println("Invalid");
	}
	Serial.flush();
}

If you are getting a y with two dots above that is a good indication that the baud rates are not the same, if they were the same you would see one of the strings you print, simple.

Also you will never get the value 102 as that is three characters and you only handle one at a time.

EDIT:

I uploaded the code onto my attiny85 threw arduino uno make edition. and its not working.

I just re-read this, I don't know what "arduino uno make edition" is but do you have the 85's fuses set correctly so it's running at 16MHz?


Rob

No I'm not running at 16mhz, I'm running at 1mhz. I don't know the differents between the 16 and the 1. Do I need to add something to the attiny so it wont blow out or pop. Cause its saying about 4.3v BOD

Edit: Ok I set it to 16mhz and still got the y line symbol, Is there something I am doing wrong here?.

I'm not familiar with how you have things set up and how you change the Arduino libs to know about the 1MHz clock, but try changing the monitor baud rate to 600 and see if you get anything legible.


Rob

I've tried that, still the same problem. I don't think I could use the serial monitor on the make edition on it. cause when I changed the baud all I get is this symbol ¥ in the monitor when I type a letter in.

What is this "arduino uno make edition"?


Rob

Yes, I know I need to get more arduino boards but this is what I have and my projects have been doing good with this board besides using the serial commands.

WHAT is what you have, I've never heard of "arduino uno make edition", I don't know what hardware we are talking about. What does a Uno have to do with an Attiny85? How are things connected? If your code is Serial.println("Hello world"); how can you just get a single character on the monitor?

Sorry I'm totally at a loss here.


Confused

Here is the link of the make edition Wanted: Arduino Projects for Arduino Day - Make: Maybe this will help a bit. I don't have a onboard chip so I use the attiny85 and 84 for my projects. I want to throw in some command codes onto my attiny85 to run leds.

That's a link to a page with the heading "Wanted: Arduino Projects for Arduino Day" which AFAICT has nothing to do with the problem. But I was about to close it when I see a link to "Arduino Uno Rev 3 (Make SMD Version)", not "arduino uno make edition" but close so I follow the link to find a page about a Uno clone.

Yet again I ask, what the heck does this have to do with a "attiny85 and 84" and how do you have things wired up.

BTW That's a rhetorical question that does not require answering because I'll be long gone.


Rob