Hello. I am trying to make basic control module for a moped/scooter and need to know if it is possible to build in a 555 timer into the program rather than an outside timer. I want to use that as the trigger for a my turn signals. The user would turn a switch, would tell arduino to turn the turn signal on and continue with the program but the 555 timer would trip a triac off and on. I really don't want to have any outside hardware if i can help it. Thanks!
You can certainly do that without any external hardware - take a look at the blink without delay example
Yes it is perfectly possible and practical to write that kind of function into your sketch. The function would most likely use the millis() timer function inside a function you called when the turn signal inputs (left and right) are sensed in your main loop and then call your left or right blinker functions as required.
Excuse me if I don't write such a function for you but rest assured it can be done and would be a better method then using external additional hardware.
Lefty
just to make sure, I just need a bit of code that will set a pin to go high for a set time and then low for a set time, for as long as the board is on, while still allowing other code to pass. This is what you were telling me to look at, right?
All I'm really trying to do is make a background 555 timer so on pin is always switching without having to manually do it so my sketch can focus on capturing events and running there code (watching for turn signal switches, key switches, throttle positioning and such)
Though now that i think about it, it might be considered an interrupt. where every [time var] then system suspends the current code at where ever it is, and switches the pin to the opposite and then continues about its way.
Sorry I am fairly at this coding language
ok... I think I just pulled the rubber ducky move on you guys (talk to a rubber ducky to solve problems you already know the solution for but don't know how to implement)
I found a detailed articale about timers and i think this might be more of what i am looking for.
http://www.engblaze.com/microcontroller-tutorial-avr-and-arduino-timer-interrupts/
Why? If you don't mind my asking.
Signal light wiring is dead simple and reliable with a spdt switch and a flasher relay. Why would you fix that? If your arduino set up fails it could be a safety issue. (Not that other motorists really see your signal light or understand hand signals.)
You'll still need the switch, it seems like a lot of effort just to eliminate a simple flasher relay.
Depending on what your other requirements are, interrupts may be overkill for your needs. The arduino is plenty fast enough to do a bunch of other stuff and keep a turn signal blinking. What's the additional code going to need to do?
Im trying to set up the arduino kina like a car ecu so that when the key is in and on, the bike goes and the lights come on. I would also like to use it as a recording device for speed, location (i have a gps recorder module that im going to try and implement), battery charge level and the likes. The arduino would also record when and what signals and lights were turned on and off. The interrupt allows me to tell the arduino its time to switch the flashing lights on or off and record all data at this time.
Then I'd suggest starting out with the method demonstrated in the blink without delay example and gradually add the other stuff. I suspect you'll find that there is no need for interrupts.
Im trying to set up the arduino kina like a car ecu so that when the key is in and on, the bike goes and the lights come on
Doesn't it do that now? I'm all for doing projects and learning and hacking stuff but when it comes to vehicles that will be operated in traffic I have concerns.
I don't know for sure, but I have my doubts that a vehicle's engine management computer also handles the signal lights. I could see an ancillary computer doing this.
A possibility I see is using the arduino to detect signal light (and even brake light) operation and log that. You'll still log that info without adding the overhead of actually operating the lights or compromising the safety and reliability of an already functioning system.