c++ - "Read" does not name a type -


i have been writing program requires me take input serial monitor in arduino. i'm having problems. here's code. update: new code have created after couple revisions.

#include <softwareserial.h>  int r1 = 20; int r2_2 = 20; int r4_7 = 20; int r5_6 = 20; int r7_5 = 20; int r8_2 = 20; int r10 = 22; int r15 = 20; int r22 = 20; int r27 = 20; int r33 = 22; int r39 = 20; int r47 = 20; int r56 = 20; int r68 = 20; int r75 = 20; int r82 = 20; int r100 = 20; int r120 = 20; int r150 = 20; int r180 = 20; int r220 = 20; int r270 = 20; int r330 = 20; int r390 = 20; int r470 = 20; int r510 = 20; int r680 = 20; int r820 = 20; int r1k = 20; int r1k5 = 20; int r2k2 = 20; int r3k3 = 20; int r3k9 = 20; int r4k7 = 20; int r5k6 = 20; int r6k8 = 20; int r7k5 = 20; int r8k2 = 20; int r10k = 20; int r15k = 20; int r22k = 20; int r33k = 20; int r39k = 20; int r47k = 20; int r56k = 20; int r68k = 20; int r75k = 20; int r82k = 20; int r100k = 20; int r150k = 20; int r180k = 20; int r220k = 20; int r330k = 20; int r470k = 20; int r560k = 20; int r680k = 20; int r1m = 20; int r1m5 = 20; int r2m = 20; int r3m3 = 20; int r4m7 = 20; int r5m6 = 20; int r10m = 20; int resistors = r1 + r2_2 + r4_7 + r5_6 + r7_5 + r8_2 + r10 + r15 + r22     + r27 + r33 + r39 + r47 + r56 + r68 + r75 + r82 + r100 + r120 + r150 + r180 + r220 + r270 + r330 + r390 + r470 + r510 + r680 + r820 + r1k + r1k5 + r2k2 + r3k3 + r3k9 + r4k7 + r5k6 + r6k8 + r7k5 + r8k2 + r10k + r15k + r22k + r33k + r39k + r47k + r56k + r68k + r75k + r82k + r100k + r150k + r180k + r220k + r330k + r470k + r560k + r680k + r1m + r1m5 + r2m + r3m3 + r4m7 + r5m6 + r10m; int aclips = 11; int blue_led = 50; int rgb_led = 1; int yellow_led = 10; int red_led = 16; int button = 102; int carbon_film = 2; int ambient_light_sensor = 10; int laser_diode = 9; int photocell = 1; int piezo_buzzer = 1; int relay = 1; int transistor_2n2222a = 1; int transistors = 0 + transistor_2n2222a; int servo = 1; int diode_1n4148 = 2; int diodes = diode_1n4148;  //this next line line highlighted read.serial(searcheditem);  void setup() { //setup code here, run once: serial.begin(9600); }  void loop() { //loop code here, run forever: if (serial.available() > 0) {   // read incoming byte:   searcheditem = serial.read();   //code here   if (searcheditem == "red led", "red led", "red led") {     searcheditem = red_led;     if (searcheditem => 1) {      serial.println("\nfound!\nyou have ", red_led, "red leds");       }     }   } } 

you have code outside of functions. can't that, that's why line "highlighted."


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -