Question
CH340 USB to TTL Serial Adaptor Then Connecting Max232 Then Connecting ATMEG Chip 328P I am able to send the singnal but I am unable
CH340 USB to TTL Serial Adaptor Then Connecting Max232 Then Connecting ATMEG Chip 328P
I am able to send the singnal but I am unable to upload my program code to the chip by using the above serial communication device! Help me to sort out the problem Folowing are the codes!
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT); } void loop() {
// put your main code here, to run repeatedly:
int val = Serial.read() - '0' ;
if (val == 1)
{ Serial.println ("on");
digitalWrite (13, HIGH);
}
else if (val == 0)
{
Serial.println("OFF");
digitalWrite(13, LOW);
}
if (val == 2)
{
Serial.println ("on");
digitalWrite (12, HIGH);
}
else if (val == 3)
{
Serial.println("OFF");
digitalWrite(12, LOW);
}
if (val == 4)
{
Serial.println ("on");
digitalWrite (11, HIGH);
}
else if (val == 5)
{
Serial.println("OFF");
digitalWrite(11, LOW);
}
while (Serial.available() == 0 );
Serial.println(val);
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started