Small Basic: How to Use Arduino
Arduino is a cheap single board computer. This article shows how to use Arduino with Microsoft Small Basic programming language.
Hardware
In this article, following hardware is required. Actually, an Arduino compatible starter kit includes these parts. And a Windows PC is needed.
- Arduino UNO R3 (or compatible board)
- USB Cable
- Breadboard
- Infrared Receiver (VS1838B)
- Infrared Remote Controller
- 5 x Jumper Wires (10cm, 1Pin, Male to Male)
Software
The following software is needed. And this article is based on Windows 10, Small Basic 1.2 and LitDev Extension 1.2.11.0.
- Arduino Software (IDE)
- Arduino IRremote Library
Step by Step Instructions
Download the Arduino Software
Download Windows Installer from https://www.arduino.cc/en/Main/Software .
Install the Arduino Software
Run the Windows Installer.
Assemble the Circuit
Assemble the Arduino circuit as follows. This circuit is for infrared receiver.
Connect the Arduino to the PC
Connect the Arduino to the PC with USB cable. LED labeled ON on the Arduino board will be on.
Start the Arduino Software
Start the Arduino Software (IDE) from the desktop icon.
Select Arduino Hardware
Select Arduino/Genuino Uno from [Tools] [Board:] menu.
Select COM Port
Select COM3 (Arduino/Genuino Uno) from [Tools] [Port:] menu.
Add IRremote Library
Download IRremote Library from http://osoyoo.com/2014/12/08/decode-infrared-remote-controller-with-ir-receiver-vs1838b/ . And add the library from [Sketch] [Include Library] [Add .ZIP Library] menu.
Copy Arduino Demo Program
Copy Infrared demo program also from http://osoyoo.com/2014/12/08/decode-infrared-remote-controller-with-ir-receiver-vs1838b/ and paste it to the IDE as a sketch.
Upload the Program to the Arduino
Push right arrow button on the IDE to compile the program and upload the binary to the Arduino.
Test the Arduino Program
Open Serial Monitor from [Tools] [Serial Monitor] menu.
And push some IR remote control buttons.
And you will see the hexadecimal values for the buttons.
Run a Small Basic Serial Monitor
Run a program BVV136 and push the remote control buttons.
Write Small Basic Program with Remote Control
Then via serial port, Small Basic program can get controls from the IR remote control. In a program HLT038, the turtle can be moved with IR remote control buttons 2, 4, 6 and 8. And clear the screen with 0 button.