Small Basic – Arduino Sample Programs


This March LitDev introduced about Arduino on this blog.  Today, I'd like to introduce my Small Basic programs using Arduino.

The first one is the IR Turtle controller (HLT038).

Screen shot of a program Turtle Controller

The circuit is like (GZN399):

Screen shot of a program OSOYOO UNO R3 0.1

The Arduino program irdemo.ino is from osoyoo.com.  More details about this program are described here.

The second one is a thermometer (KKK886).

Screen shot of a program Thermometer

The circuit is like (GZN399-0):

Screen shot of a program OSOYOO UNO R3 0.2

The Arduino program is as follows.

//TMP36 Pin Variables
int sensorPin = 5; // the analog pin the TMP36's Vout (sense) pin is connected to
                   // the resolution is 10 mV / degree centigrade with a
                   // 500 mV offset to allow for negative temperatures
float lastTemp;    // last temperature
 
/*
 * setup() - this function runs once when you turn your Arduino on
 * We initialize the serial connection with the computer
 */
void setup()
{
  Serial.begin(9600);  // Start the serial connection with the computer
                        // to view the result open the serial monitor 
}
 
void loop()                     // run over and over again
{
  //getting the voltage reading from the temperature sensor
  int reading = analogRead(sensorPin);  
 
  // converting that reading to voltage, for 3.3v arduino use 3300
  int mV = map(reading, 0, 1023, 0, 5000);
 
  // now print out the temperature
  float temperatureC = (mV - 500) / 10.0 ;  //converting from 10 mV per degree with 500 mV offset
                                            //to degrees ((voltage - 500mV) times 100)
  if (temperatureC != lastTemp) {
    Serial.println(temperatureC);
    lastTemp = temperatureC;
  }
  delay(1000);                                     //waiting a second
}

Arduino can be connected with many types of sensors or actuators.  So, with this device, we can explore Small Basic world more and more interesting!

Comments (8)

  1. Tryhest says:

    nice work nonki))
    updated ur arduino project in order to simulate 3 leds flashing in rgb: NCH457

  2. YLed says:

    Very interesting !
    SB is much powerful than i thought 🙂

  3. Fantastic Arduino samples!

    1. Tryhest says:

      found some great site about arduino and rasp.pi: http://randomnerdtutorials.com/

  4. elaine says:

    Your connection graph is very clear and nice. Which graph tool do you use?

    1. elane, this tool is just a Small Basic program. Thank you for your comment.

Skip to main content