Syntax
Else vs else
Yes but where have you ever seen an example that wrote else with a capital E?
Delta_G:
Yes but where have you ever seen an example that wrote else with a capital E?
As well? I did not understand . How Must Stay the rest of the code After the delay
deyvyd:
As well? I did not understand . How Must Stay the rest of the code After the delay
You have to get the braces right. Maybe this would be a good time to find some C++ tutorials and learn what those braces are for. Then you could know where they need to go and you could fix your code.
Delta_G:
You have to get the braces right. Maybe this would be a good time to find some C++ tutorials and learn what those braces are for. Then you could know where they need to go and you could fix your code.
thank you, I FIND tutorials, but I need to code urgently paragraph hum work you CAN fix it for me?
deyvyd:
thank you, I FIND tutorials, but I need to code urgently paragraph hum work you CAN fix it for me?
paragraph hum?
You mean this is homework? A school assignment? So if we fix it for you that would be cheating on your school work. I can't be a party to cheating. I have some morals left. You should be better than that as well. Don't be a dirty cheater.
Delta_G:
paragraph hum?You mean this is homework? A school assignment? So if we fix it for you that would be cheating on your school work. I can't be a party to cheating. I have some morals left. You should be better than that as well. Don't be a dirty cheater.
You can rest assured, it's not that, no study program yet, it's just a project I'm trying to control the lights in my room by phone, I'm learning the internet, but could not solve this problem and wanted to help.
Learning how to do this should be more important than having someone do it for you.
Don't understand the urgency if it is not homework.
.
LarryD:
Learning how to do this should be more important than having someone do it for you.
Don't understand the urgency if it is not homework..
is why it is already installed, so lack the code to work, to eager to work, so I need to know q is wrong in the code, someone will be able to help me?
As mentioned in #17
char command Serial.read = ();
Does this look correct?
.
LarryD:
As mentioned in #17
char command Serial.read = ();Does this look correct?
.
I dont Know , what should I put ?
Read:
Serial:
Reference:
Foundations:
Would've made a whole lot more sense if you had posted this question in the Portuguese group (especially if it is so important).
Pete
Hi,
like all other members said you should know atleast what you want to do with code before you write it.'
anyway i try to clean the code little bit , but i didnt check the functionality of it
see if you can get your head around it.
int LED1 = 10; // Led pin
boolean Status1 = false; // Check LED status
void setup () {
Serial.begin (9600); // Initialize the comunicaç࣠serial speed 9600
pinMode (LED1, OUTPUT); // Set the LED pin as output
digitalWrite (LED1, LOW); // Starts LED Off
}
void loop () {
char command;
if (Serial.available())
{
command = Serial.read();
int key1 = digitalRead (4);
if (key1 == HIGH) {// If the key is precionada get high value
if (Status1) {// Check if the led is on or off according to variável boolean
// Run this part if it is connected
digitalWrite (LED1, LOW); // Led off
Status1 = false; // Change to the false status so that the next time he indentifique to off
Serial.println ( "off"); // Send the string to indicate that the LED is off
} else {
// Run this part if it is off
digitalWrite (LED1, HIGH); // LED connected
Status1 = true; // Change the status to true
Serial.println ( "on"); // Send the string to indicate that the LED was turned on
}
}
delay (250);
}
if (command == 'd') {// if the serial receive d character
if (Status1) {
digitalWrite (LED1, LOW);
Status1 = false;
Serial.println ( "off");
}
}
if (command == 'a') {// if the serial receive the character to
if (Status1) {
digitalWrite (LED1, HIGH);
Status1 = true;
Serial.println ( "on");
}
}
}
You mentioned earlier that you copied this from some other source.
Perhaps go to that source - to compare your code with the original.
This group have already given you a lot of help, but you're insisting to write it the way you think it should be done - not the way it has to be written.
We're still here - and willing to HELP, but not to WRITE the code for you.
C is quite forgiving, but does return some cryptic error messages - if you're really keen - these should stimulate you to ask specific questions and look online for examples.
There's no urgency greater than the need to learn!