I've been trying for a couple of months now to learn enough about Arduino programming to write a simple program for an AdaFruit Trinket (ATTiny85) that uses only one input and two outputs. Any fool should be able to do that, right? Here's what the sketch does:
At the start of the loop, the program waits indefinitely for switch S1 to close. When that happens it blinks LED1, turns on LED2, and starts a 100 second timer. At the end of 100 seconds, or when S1 closes again, whichever occurs first, LED1 is blinked again, LED2 is turned off, and the program returns to the start.
I've purchased four books (the best one being Sams Teach Yourself Arduino Programming in 24 Hours) and read everything I could find, including Robin2's excellent "Demonstration Code for Several Things at the Same Time". I've tried splitting the program into several functions, following Robin2's "state" suggestion, using "delay" for blinking the LED and (millis() + 100000) for the running timer. But I can't find much info on how to "goto", "gosub", or "call" a function, and after compiling maybe a hundred times by trial and error, the pseudo "10" programming has brought me to my knees with its cryptic compile error messages and demands for placing brackets, braces, and semicolons just right. Even on those occasions when the compile was successful and the program was running (incorrectly) I usually couldn't tell how I had fixed an error. I keep thinking that if you put a hundred monkeys in a room full of Arduinos and wait a thousand years, one of them will eventually write some workable code.
I know the forum frowns on anyone trying to get someone else to write code for them, but is there a chance someone will give me a clue or two on this problem, or point me to something similar. If I can just get started I'll do all the debugging, the hard way. I'm nearly 87 years old and had hoped to finish this project before cashing in.
okasional