need solution to language issues

this is my first issue with writing code so i am definitely a noob. i am working my way towards learning code to control physical hardware i.e. a remote control gas engine powered vehicle. i have plans to ultimately have sensory information transmit/receive between remote and vehicle along with commands. so the first thing i wanted to work on was making sure i know how much battery i have left in the vehicle. i am modifying the analogreadserial example in the arduino software using a parallel set of leds as visual reference without looking at serial monitor. if im out in the field i won’t have access to a computer screen. as the battery loses energy lights will turn off in succession until the last few remain. i wanted to add a “look at me” feature to these lights making them flash. heres where i got into trouble. i get there error messages for having the syntax in the wrongs spots and incorrect syntax used and so silly me thinks, “well why don’t you just give me the correct answer”. so my question is how can i make these two lights blink within this the code.

also any advice as to simplifying the code to free up some memory would be very helpful!

battery_life_meter.ino (2.29 KB)

You can’t have 3 loop() functions. All your program must “fit” in only one loop(). Try the code attached.

battery_life_meter.ino (2.08 KB)

thanks luisilva! ok it works now but not as i thought it would and im also noticing that it is working slower now than it was before i added the blink code(last two lights). what i thunk i was doing was making the the last two blink at 1000 together but they dont. pin 12 and 11 blink 1000 delay 1000 then only pin 12 blinks 500 delay 500 then loops. theres definitely some lag time when adjusting the pot switch i dont get it can some one explain or maybe offer a better direction.

oh and i forgot to mention that im using a micro

Please dive into the use of array's as that will simplify your code.

second, there is a blink without delay example that shows how to make code without the blocking delay call to make your sketch far more responsive.

The demo several things at a time is an extended example of the BWoD technique.


awesome will do thanks guys!!!