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.
duration = pulseIn(PB2, HIGH);
if (duration < 1300)
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
pinMode(ledPin, OUTPUT); // sets the digital pin PB0 as output
pinMode(inPin, INPUT); // sets the digital pin PB2 as input
val = digitalRead(inPin); // read the input pin
digitalWrite(ledPin, val); // sets the LED to the button's value