Go Down

Topic: Arduini Pro Mico - blinking led by impulse receiver RC (Read 839 times) previous topic - next topic

Orso_Bruno

Hi from Italy , sorry for my english. I'm new in the Arduino's world
I want to blink an LED (led 3w 2.5/3v) with a pulse from a receiver RC hobby.
There is a code already written that I can adapt?
for example:
https://www.youtube.com/watch?v=yP90ZO416Io

thanks a lot

AWOL

As long as any replies there are translated and posted here (and vice versa) it's OK.

UKHeliBob

Quote
There is a code already written that I can adapt?
Untested and not the preferred way to do it but try this
Code: [Select]

const byte inputPin = 2;
const byte ledPin = 3;
const long longPeriod = 1000;
const byte shortPeriod = 500;
byte ledState = LOW;

void setup()
{
  pinMode(inputPin, INPUT);
  pinMode(ledPin, OUTPUT);
}

void loop()
{
  if (pulseIn(inputPin, HIGH) <= 1500)
  {
    delay(longPeriod);
  }
  else
  {
    delay(shortPeriod);
  }
  ledState = !ledState;
  digitalWrite(ledPin, ledState);
}
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Orso_Bruno

thanks for the answers and code
I'll try as soon as possible
Can I connect leds directly to the Arduino board? (not use transistor/mosfet)
the leds are:



Spec:
Input:  2.5-3 volts (3watt)
Colour: Green
Brightness: 70-80 Lumens
Diameter: 20mm
Weight: 4g

AWOL

Quote
Can I connect leds directly to the Arduino board? (not use transistor/mosfet)
the leds are:
As a rule-of-thumb I'd say "if the LED requires a heatsink (like yours), then no, you can't connect it directly to an AVR I/O pin".

nickgammon

Quote
Input:  2.5-3 volts (3watt)
So, one amp, eh?

The Arduino does not have one amp output drivers.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

Go Up