I have managed to program an ATtiny13 to use as a controller for LED strobe / pulse lights.
I would like to add the ability to turn a LED on and off by using an auxiliary channel on my
JR9303 2.4Ghz remote.
I found this sketch but it produces an error I can't find an explanation for.
SwitchRC_AUX.cpp: In function 'void loop()':
SwitchRC_AUX:10: error: 'pulseIn' was not declared in this scope
I can not find PulseIn defined in the ATtiny Data sheet and search returned nothing
I also attempted this code but it only produces a dim or bright LED not the expected on or off
I adjusted the int val entry but got the same result.
/only switches LED between dim and bright using gear chanel
//with end points set to =/-150 Expected result was PB2 HIGH or LOW
int ledPin = PB2; // LED connected to digital pin PB0
int inPin = PB0; // pushbutton connected to digital pin PB2
int val = 0; // variable to store the read value
void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin PB0 as output
pinMode(inPin, INPUT); // sets the digital pin PB2 as input
}
void loop()
{
val = digitalRead(inPin); // read the input pin
digitalWrite(ledPin, val); // sets the LED to the button's value
}
I am currently working on version 0.16 which will probably include this function.
This version could be released anywhere between now and around a week from now (not really sure).
My current Sketch is using the internal timer, my guess is the pulseIn function will require some type of interrupt to allow the blink portion
of the sketch to continue running the loop.
gizmoDave:
I will watch for a new version release notice.
My current Sketch is using the internal timer, my guess is the pulseIn function will require some type of interrupt to allow the blink portion
of the sketch to continue running the loop.
The pulseIn function does NOT use an interrupt and is a busy wait loop even in the standard core.
Hi,
Why not use a 328 or 168 ? You can add a full MFU (Multi Function Unit) capability then, engine sounds, signal lights etc etc ?
Off the shelf multi function units are incredibly expensive and a little bit daft if you ask me, the tamiya one includes a vibration unit to make your models tail pipes wobble at idle -
I'd bet there is a way to multiplex this in software only but it is really late here and I cannot think of it off hand right now.
Time to go to bed for tonight now..
DuaneB:
Hi,
Why not use a 328 or 168 ? You can add a full MFU (Multi Function Unit) capability then, engine sounds, signal lights etc etc ?
Off the shelf multi function units are incredibly expensive and a little bit daft if you ask me, the tamiya one includes a vibration unit to make your models tail pipes wobble at idle -
I am not so sure, the sound effects seem out of synch, I wish I could find the video of the vibration unit in action, it wobbles the truck as you rev !
I am just adding an audio amp to my lap timer project but have been thinking about a way to use it to show how much intervention I have in my Yaw Control project, it would be really useful feedback for fine tuning the system and my driving style, imaging progressive skidding sounds when the system needs to intervene -
and in action, you will have to imaging sound effects I have a lot of LM386 chips so will have a go at adding them shortly -
I have several Ultra Micro (Flying Weight: 1.2 oz (35 g) aircraft that I am outfitting with lights, I have 10 ATtiny13 chips for these small aircraft where added weight is critical.
I might try a larger chip for other projects where more functions are required and weight is not as big an issue.