you can put any values, but according to our code it means we have pressed FAN ON button in app.
@robertmccully27925 жыл бұрын
good video,,,, computers have a long way to go before they are useful without a lot of code,, i can just turn on a light without saying a word.
@its_scripted4 жыл бұрын
when i try to compile code. then there is showed compilation errors..
@RoboticaDIY4 жыл бұрын
may be you are doing something wrong in code, what error you are getting? If code is correct then check your port and board (Go to tools > board/ port)
@its_scripted4 жыл бұрын
i got this error message Compilation error Message /sdk/hardware/tools/avr/bin/avr-g++ -std=gnu++11 -c -g -Os -w -mmcu=atmega328p -DF_CPU=16000000L -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -DIDE="ArduinoDroid" -DARDUINO_ARCH_AVR -DARDUINO_AVR_UNO /build/sketch_mar14c.cpp -o /build/sketch_mar14c.cpp.o /sdk/hardware/tools/avr/bin/avr-gcc -Os -Wl,--gc-sections -mmcu=atmega328p -o /build/sketch_mar14c.cpp.elf /build/sketch_mar14c.cpp.o /coreBuild/core.a -L/build -lm /coreBuild/core.a(main.cpp.o): In function `main': /sdk/hardware/arduino/cores/arduino/main.cpp:11: undefined reference to `setup' /sdk/hardware/arduino/cores/arduino/main.cpp:14: undefined reference to `loop' collect2: error: ld returned 1 exit status Return code is not 0 i used your code char data = 0; //Variable for storing received data void setup() { Serial.begin(9600); //Sets the data rate in bits per second (baud) for serial data transmission pinMode(13, OUTPUT); //Sets digital pin 13 as output pin for Light pinMode(12, OUTPUT); //Sets digital pin 13 as output pin for Fan } void loop() { if(Serial.available() > 0) // Send data only when you receive data: { data = Serial.read(); //Read the incoming data and store it into variable data // For Light if(data == '1') //Checks whether value of data is equal to 1 digitalWrite(13, HIGH); //If value is 1 then Light turns ON else if(data == '0') //Checks whether value of data is equal to 0 digitalWrite(13, LOW); //If value is 0 then Light turns OFF // For Fan else if(data == '2') //Checks whether value of data is equal to 2 digitalWrite(12, HIGH); //If value is 2 then Fan turns ON else if(data == '3') //Checks whether value of data is equal to 3 digitalWrite(12, LOW); //If value is 3 then Fan turns OFF //For ALL ON or OFF else if(data == '4') { //Checks whether value of data is equal to 4 digitalWrite(13, HIGH); //If value is 4 then Light turns ON digitalWrite(12, HIGH);} //If value is 4 then Fan turns ON else if(data == '5') { //Checks whether value of data is equal to 5 digitalWrite(13, LOW); //If value is 5 then Light turns OFF digitalWrite(12, LOW); } //If value is 5 then Fan turns OFF } } i was trying to upload programs by a android phone