Introduction

In this lesson, we will show how to use the IR control an LED. When we press the “OK” button, the LED will be turned on, and when we press the “OK” button again, the LED will be truned off.

Preparations

HARDWARE

Connection

Build the circuit as below:

CODE PROGRAM

After above operations are completed, connect the OSOYOO Basic board to your computer using the USB cable. The green power LED (labelled PWR) should go on.Open the Graphical Programming software Mixly and follow the next operations:

Click Save aftogramming is done. Select the board type and serial port before uploading. For instause a Uno board, just select Arduino/Genuino Uno: if you use a Mega2560, select Arduino/Genuino Mega or Mega2560. 

Select the serial device of the Arduino board from the COM menu. This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). To find out, you can disconnect your Arduino board and re-open the menu; the entry that disappears should be the Arduino board. Reconnect the board and select that serial port.

Next,upload the code. If the uploading fails, check and correct the code according to the prompts.

Finally, the staus will change to ‘Upload success!’.

Running Result

A few seconds after the upload finishes, press the “OK” button of a remote controller, the LED attached connected to D12 will be light up. Then press “OK” again, and the LEDs will go out.