Archive for October, 2018

Example programs for ArduinoPixed

October 8th, 2018

ArduinoPixed adds 3 USB ports and an onboard Arduino. Setting up Arduinopixed is easy. Just use the 4 provided screws to attach it to Raspberry Pi Zero W ( Add a USB Wifi Board if you are using Raspberry Pi Zero). The Extra USB ports on the Arduinopixed allows you to work directly on the Raspberry Pi - No SSH or Serial Port required ( but you can do that if you want to). Hook the Pi Zero to HDTV using HDMI to HDMI Mini Cable. Hook a Keyboard and Mouse to the USB Ports of the Arduinopixed.

After powering it on - set up your wifi.

Install the Arduino using

#sudo apt-get install arduino

Now you should be able to run the Arduino from the menu. Here are some example programs to get you started.

Example : LED Blinking

This example will blink and LED for 1 sec and off for 0.2 second on the Arduinopixed. Note that the LED is connected on Pin 6 in place of 13 in Arduino or Arduino Nano.

void setup() {
pinMode(6, OUTPUT);

void loop() {
digitalWrite(6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(6, LOW); // turn the LED off by making the voltage LOW
delay(200); // wait for a second

Example : LED ON off on Push button

The example will turn on or off the LED on Arduoinopixed depending upon if the the Push Button is pressed or not. The push button is connected on Pin 7 and is normally high. When the Push Button is pressed, it turns low.

const int buttonPin = 7; // the number of the pushbutton pin
const int ledPin = 6; // the number of the LED pin

// variables will change:
int buttonState = 0; // variable for reading the pushbutton status

void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);

void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
} else {
// turn LED off:
digitalWrite(ledPin, LOW);

Example : A/D Converter that throws Sensed value at Serial Port every 500 ms

const int analogInPin = A7; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 6; // Analog output pin that the LED is attached to

int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)

void setup() {
// initialize serial communications at 9600 bps:

void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 0, 255);
// change the analog out value:
analogWrite(analogOutPin, outputValue);

// print the results to the Serial Monitor:
Serial.print("sensor = ");
Serial.print("\t output = ");

//500 ms wait