Intel® Edison and Arduino Breakout Kit



The Intel® Edison is an ultra small computing platform that will change the way you look at embedded electronics. Each Edison is packed with a huge amount of tech goodies into a tiny package while still providing the same robust strength of your go-to single board computer. Powered by the Intel® Atom™ SoC dual-core CPU and including an integrated WiFi, Bluetooth LE, and a 70-pin connector to attach a veritable slew of shield-like “Blocks” which can be stacked on top of each other. It’s no wonder how this little guy is lowering the barrier of entry on the world of electronics!

The Intel® Edison packs a robust set of features into its small size, delivering great performance, durability, and a broad spectrum of I/O and software support. Those versatile features help meet the needs of a makers, inventors, and beginners. This is a module with a high speed processor and WiFi and Bluetooth Radios on board. It’s low power and small footprint make it ideal for projects that need a lot of processing power, but don’t have the ability to be near a larger power source or have a large footprint.

This kit also includes a Arduino Breakout, which essentially gives your Edison the ability to interface with Arduino shields or any board with the Arduino footprint. Digital pins 0 to 13 (and the adjacent AREF and GND pins), analog inputs 0 to 5, the power header, ICSP header, and the UART port pins (0 and 1) are all in the same locations as on the Arduino Uno R3 (Arduino 1.0 pinout). Additionally, the Intel® Edison Arduino Breakout includes a micro SD card connector, a micro USB device port connected to UART2, and a combination micro USB device connector and dedicated standard size USB 2.0 host Type-A connector (selectable via a mechanical microswitch). Though this kit won’t turn your Edison into an Arduino itself, you will, however, gain access to to the Arduino’s shield library and resources!


  • Edison

    • Intel® Atom™ system-on-a-chip (SoC) based on leading-edge 22 nm Silvermont microarchitecture including a dual-core CPU and single core microcontroller (MCU)
    • Integrated Wi-Fi, Bluetooth LE, memory, and storage
    • Support for more than 30 industry-standard I/O interfaces via a 70- pin connector
    • Support for Yocto Linux, Arduino, Python, Node.js, and Wolfram
    • Open source community software tools enabling ease of adoption and inspiring third-party app developers to build apps for consumers.
    • EDI1.SPON.AL.S (System-On-Modules - SOM Edison Module IoT Internal Antenna)
  • Arduino Breakout

    • Compatible with Arduino Uno (except only 4 PWM instead of 6 PWM).
    • 20 digital input/output pins including 4 pins as PWM outputs
    • 6 analog inputs
    • 1 UART (RX/TX)
    • 1 I2C
    • 1 ICSP 6-pin header (SPI)
    • Micro USB device connector OR (via mechanical switch) dedicated standard size USB host Type-A connector
    • Micro USB device (connected to UART)
    • SD Card connector
    • DC power jack (7V – 15V DC input @ 500mA)


Getting Started with Intel® Edison

This guide explains how to get started with your Intel® Edison.

  • Before you start
    In this guide it is assumed that you are using an Intel® Edison kit for Arduino, but the same explanation is valid for the Intel® Edison Breakout Board. It is also assumed that you have connected the Intel® Edison to the Breakout Board. If not please make reference to the Intel® Tutorial about how to do that.

  • Quick Start
    The Intel® Edison board is programmed using the Arduino Software (IDE), our Integrated Development Environment common to all our boards. You should have already it installed on your PC, as explained in the home page of Getting Started.

The next step requires the addition of the Intel® Edison Core to the Arduino Software (IDE). This simple procedure is done selecting Tools menu, then Boards and last Boards Manager. Select Arduino Certified as type and then click on the Intel i686 boards by Intel. Select the latest core and then Install.


When the process is completed, the Intel Edison board will be available in the boards list.

  • Connect the board to your PC
    To upload Arduino sketches the Intel® Edison board must be powered up and connected to your computer. It is suggested to use two micro USB cables to connect the board to your PC because in this way more current is available if needed.

Find the microswitch in between the USB ports on the expansion board. Switch the microswitch down towards the micro-USB ports, if it isn't already, as shown in the figure below:


A green light should light up on the expansion board. If it does not, check your connection.


Wait a moment for the board to boot up. You will know that the board is fully initialized when your computer mounts a new drive (much like inserting a SD card into your computer).

Note: If you do not see a new drive, and the LED light (DS1 on the Arduino expansion board) is occasionally turning on and off, it is likely that your computer is not providing enough current. You may need to use a DC power supply as explained at Power Through DC Plug here.

  • Open the blink example

Open the LED blink example sketch: File > Examples > 1.Basics > Blink.


  • Select your board

You'll need to select the Intel® Edison in the Tools > Board menu as shown below:


  • Select your serial port
    Select the serial device of the board from the Tools > Serial Port menu. The easiest way to find what port the board is using is by disconnecting your board, restarting the IDE, and re-opening the menu; the entry that disappears should be the Intel® Edison board. Reconnect the board, restart the IDE, and select that serial port.

  • On Windows
    The port is likely to be COM3 or higher and is called "Intel Edison Virtual Com Port" in the Device Manager. It is NOT "USB Serial Port". COM1 and COM2 are usually reserved for hardware serial ports:


  • On Linux
    The port is likely to be /dev/ttyACM1:


  • On Mac OS X
    The port is likely to be /dev/cu.usbmodemxxxx. If you have multiple such devices, select any one of them as they should all give the same results:


  • Upload and Run your first Sketch

Click the Upload button in the upper left to load and run the sketch on your board:


You should see a Transfer complete message when it has uploaded:


The DS2 LED on your board should now blink with a 1 second delay.


You have successfully set up your Intel® Edison board and uploaded your first sketch.


  • Bus Status using Artik Cloud and Intel Edison


Hardware components:

  1. Intel Edison
  2. Breadboard (generic)
  3. Jumper wires (generic)
  4. Push Button

Software apps and online services:

  1. Intel RealSense SDK
  2. Samsung IoT ARTIK Cloud for IoT
  3. Microsoft Azure

This is an IOT project which helps the Bus travelers to know the rush in the bus in-order to take proper decision based on it. For example if someone heavy and breakable things in his/her hands then it is not safe to travel in a crowded bus but in-order to know the status of the bus one should wait until the bus reaches the stop. But if you know the number of passengers the bus in the before the bus reach the stop then we could save time and take a taxi.

Now lets start with the project for that there are certain steps :

  • Setup an Device in Artik Cloud
  • Code and assemble Intel Edison
  • Create a Web Page and an App

Setting up an Device in Artik cloud
Artik cloud can handle multiple requests at a time without any downtime and it is simple to use.
First create a free Artik Cloud account by clicking here or by going to . If you already have an account then just simply login here : ..After that Open Developers portal by clicking on Developer menu from the menu bar or simply goto .
Click on Device type from the Dashboard menu or click here


Then give it a Display device name and unique name (It should unique and spaces are not allowed) and click Create Device type. Here i give my device Display name as Artik Bus and unique name as artik.bus



After that on Manifest menu click NEW MANIFEST

Then type count as Field name and Data type as long (It should select automatically if you select count as field name)


And click Save



Now you were successfully created your first device manifest for storing the number of passengers

Now lets create an virtual device using the manifest that we were created. For that goto and click on Devices from My Artik Cloud menu or goto :


If you not yet created any Device it directly ask to search for your device. Other ways click on Connect another device and search your device name that you created before and select it and give it a name and then click on Connect device.


Now you created your device

Next you should connect your edison board with Artik cloud before that you should copy the Device ID and Device Token. For that click on the small gear (Settings) icon on the near the device name and a pop-up will come. Click on generate device token and you will get a token. Copy the Device ID and the Device Token for later use.


Code and assemble Intel Edison

This project is using Node.js language and Intel XDK as the IDE. This project is not going too deeper into now you can use XDK but you will get the basics to use

After downloaded the setup tool you could setup the by installing drivers , flashing firmware , setting up wifi connection ( If already done no need to setup again ). Now download install Intel XDK and connecting the edison to computer or any other power source. Find the local IP address of edison by going to router settings or by connecting edsion to pc via usb and get IP from the Edison setup tools.

Wire up the board as following


Here 12 and 8 pins are connected to 2 push buttons and the other end of push button to 5v


Open Intel XDK and on the bottom of the IDE click the dope down menu named IOT devices and click Add manual connection


Then on the pop-up enter the local IP of edison and thes username and password rest is same. In our case IP address is . And click connect


It will show connected message

Now click on top left arrow and click New project. Click on template and select blank template.


After that click on Continue and give it a name.

Use the following code there

var mraa = require('mraa'); // require mraa
var request = require("request"); //req 
var auth = "Bearer xxxxx"; // Device token 
var dev = "xxx"; //device ID 
var count = 0; // Setting the inital value of count as 0 
var pinIn = new mraa.Gpio(12); // Pin for in 
var pinOut = new mraa.Gpio(8); // pin for OUt 
pinIn.dir(mraa.DIR_IN); // setting pin IN as INPUT mode 
pinOut.dir(mraa.DIR_IN); // setting pin OUT as INPUT mode 
// Setting default value as LOW 
//Function which listen for the the push buttons and make it act as a switch 
function check() { 
   var ch = 0; // help to use pushbutton as switch ( one can hold the push button as much they need but only one request is considered) 
   var inner =; 
   if (inner == 1) { 
       while ( == 1) {} 
       ch = 1; 
   var outer =; 
   if (outer == 1) { 
       while ( == 1) {} 
       ch = 1; 
   if (ch == 1) { 
       console.log(count) // printing the current count 
       ch = 0; 
   setTimeout(check, 300); 
console.log("Running"); // Print running when program starts 
post(0); //uploading 0 to artik when starts 
check(); // starting the fucntion check() to listen pushbuttons 
// Function which upload to artik 
function post(c) { 
   // seting the properties to upload 
   var options = { 
       method: 'POST', // reqest type 
       url: '', // api request url 
       headers: { 
           'Content-Type': 'application/json', // setting conect type as json 
           'cache-control': 'no-cache', // don't store any cache' 
           'authorization': auth // passing the token as the header 
       //passing data as json though body of the post request 
       body: '{\r\n\t"sdid": "' + dev + '",\r\n\t"type": "message",\r\n\t"data": {\r\n\t\t\t"count": "' + c + '"\r\n\t\t}\r\n}' 
   //seting the the request with the properties above mentioned 
   request(options, function(error, response, body) { 
       if (error) throw new Error(error); 
       console.log(body); // printing the response 

Here replace

var auth = "Bearer xxxxx";

xxxxx with your device token

var dev = "xxxxx"; //device ID 

xxxxx with device ID

code could find at Github

Now click on upload button from the bottom


And then after shows Upload Complete click run button


And it will show Running

If in any case it shows request not found then goto SSH terminal tab at bottom and fill up the server details such as ip, username, password and connect. Then type

npm install request

It will solve the problem

Now try to press the pushbutton you can see a JSON responding back with an ID. It shows it working .

For confirming it goto and login. Then select charts from My Artik Cloud

And click on +/- CHARTS at left corner and tick the option count


Now you can see a chart


Creating Web Page and an App
For the web app we are using azure with dream-spark subscription. If you are conferrable to use any other host feel free to use that ( The host should support node.js because in this project we are using node js as the server side language)

First you should install Node js in your computer for that goto : and download & install it in your system.

After that open comment prompt(windows) or terminal (Mac, Linux) and type

npm install -g express-generator

Then when installation completed open comment prompt in any directory where you want to create your project and type following comment

express <projectname>

Here is the project name as you wish

Now open the folder that automatically created and open app.js file and replace it with following code

var express = require('express');
var path = require('path'); 
var favicon = require('serve-favicon'); 
var logger = require('morgan'); 
var cookieParser = require('cookie-parser'); 
var bodyParser = require('body-parser'); 
var routes = require('./routes/index'); 
var app = express(); 
// view engine setup 
app.set('views', path.join(__dirname, 'views')); 
app.set('view engine', 'jade'); 
// uncomment after placing your favicon in /public 
//app.use(favicon(path.join(__dirname, 'public', 'faviscon.ico'))); 
app.use(bodyParser.urlencoded({ extended: false })); 
app.use(express.static(path.join(__dirname, 'public'))); 
app.use('/', routes); 
// catch 404 and forward to error handler 
app.use(function(req, res, next) { 
   var err = new Error('Not Found'); 
   err.status = 404; 
// error handlers 
// development error handler 
// will print stacktrace 
if (app.get('env') === 'development') { 
   app.use(function(err, req, res, next) { 
       res.status(err.status || 500); 
       res.render('error', { 
           message: err.message, 
           error: err 
// production error handler 
// no stacktraces leaked to user 
app.use(function(err, req, res, next) { 
   res.status(err.status || 500); 
   res.render('error', { 
       message: err.message, 
       error: {} 
module.exports = app;

And then routes/index.js with following

var express = require('express');
var router = express.Router(); 
var request = require("request"); 
var sdids = "xxxxx"; //replace with device id 
var token = "xxxxx"; //replace with device token 
/* GET home page. */ 
router.get('/', function(req, res, next) { 
router.get('/count', function(req, res, next) { 
   var options = { 
       method: 'GET', 
       url: '', 
       qs: { sdids: sdids, count: '1' }, 
       headers: { 
           'cache-control': 'no-cache', 
           'authorization': 'Bearer ' + token 
   var data, k = 0; 
   request(options, function(error, response, body) { 
       if (error) throw new Error(error); 
       data = JSON.parse(body).data[0].data; 
module.exports = router; 

Here edit following

var sdids = "xxxxx"; //replace with device id 
var token = "xxxxx"; //replace with device token

Replace views/index.jade

extends layout 
block content 
     function getData(){ 
     $.ajax({url:'/count', dataType: "json", success:function(result){ 
     // Get the result and show it 
     var message = result.count; 
     document.getElementById("data").innerHTML = JSON.stringify(message); 
     $( document ).ready(function() { 
     document.getElementById("data").innerHTML = "0" 
     window.setInterval(getData, 2000); 

Replace views/layout.jade

doctype html 
   title= title 
   link(rel='stylesheet', href='/stylesheets/style.css') 
   block content 

and also replace public/stylesheets/style.css

   margin: 0; 
   padding: 0; 
   background: #eee; 
#container { 
   display: table; 
   width: 100%; 
   height: 100vh; 
#data { 
   font-size: 20em; 
   color: #202020; 
   display: table-cell; 
   vertical-align: middle; 
   text-align: center; 

Create a file named jquery.js in public/javascripts

Code for that will get from :

Or your could find the complete code on Github

Now upload this project to Github by using git / Github desktop or even your could upload it directly.


Next thing we need is to host this project in azure. For that goto : and create an account if you don't already have.

  • Click on new from the side bar
  • Then select Web + mobile
  • From that select Web App
  • Give it a name and resource group as you wish


Now open that app from dashboard ( if you pinned it to dashboard ) or just select it from All resources.

  • On the left side you can see Deployment option click on it
  • Then click Choose resource settings
  • And select Github ( If it is first time it will ask for authentication )


  • Now click on chose project and then select your project
  • and click OK


Wait for some time until fetch all data and install packages


After the fetching completed you could just your azure web app by the url. If you don't know you could find it in your dashboard.


Open it and you could find the number of passengers. When you press the push button it will also upload. It almost instant update ( about 3 - 5 seconds ).


You could easily create an mobile app from that by going to appsgeyser and create an account (Login if you already have )

  • Now goto :
  • Enter your azure url and click next
  • Give it a name and click next
  • Give it a DESCRIPTION and click next
  • And use default icon or upload one
  • Finally click Create


  • Next click on Download Button


  • When it shows a pop-up just click or test your app
  • and click download button
  • It will start downloading


  • Install it in your phone.
    Now you just also created your mobile app. It is simple as making a coffee with a coffee machine which integrated with IOT

  • Electronic Voting Machine



Hardware components:

Intel Edison

Software apps and online services:

Google firebase


An electronic voting machine(called as evm from now on) connected to internet that can authenticate a user based on a primary key and biometrics ( biometrics not included in this project but it was our final goal) and also weather user has already voted or not.

Once the user is authenticated he will have access to a panel through which he can vote for a candidate and evm will update a database where votes are being stored and also send an email to the user saying that he cast his vote. This update will happen in real time therefore election results can be declared at closing of election day and also election statistics can be calculated to improve future election exercises. We used firebase as backend for lack of lot of programming time.

The project is based on node.js.


  • Electronic Voting Machine


Intelligent Control Of Internal Climate Equalization



Hardware components:

  • Intel Edison
  • SeeedStudio Grove starter kit plus for Intel Edison
  • Electric heating pad
  • DHT11 Temperature & Humidity Sensor
  • Breadboard (generic)
  • PC fan

Software apps and online services:

  • Amazon Web Services AWS IoT
  • Johnny-Five

Many larger homes, especially multi level homes, have a problem maintaining a constant temperature throughout the entire building. The thermostat may be set at 70 on the main floor but the basement is frigid during the winter and the upper level is near tropical during the summer. Our project aims to tackle this problem without having to replace the entire HVAC system.

We propose to place a localized Station in each room that monitors temperature and humidity while controlling entering airflow via the HVAC duct. Stations will open and close vents to control the incoming hot or cool air via a motorized system.

Each of these stations will communicate with a centralized Base which controls the heat and A/C settings. The Base has the ability to shut off the A/C or heat when all the rooms have met their preset conditions.

A future goal would be to monitor energy consumption and use weather forecast data to optimize our system. We seek to maintain a stable indoor environment while also reducing the carbon footprint.


Final Product



 * Copyright 2010-2015, Inc. or its affiliates. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 * or in the "license" file accompanying this file. This file is distributed
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.

 var five = require("johnny-five");
 var Edison = require("edison-io");
 var board = new five.Board({
   io: new Edison()
//node.js deps

//npm deps

//app deps
//const deviceModule = require('..').device;
//const cmdLineProcess = require('./lib/cmdline');

//begin module

function processTest(args) {
   // The device module exports an MQTT instance, which will attempt
   // to connect to the AWS IoT endpoint configured in the arguments.
   // Once connected, it will emit events which our application can
   // handle.
   const device = deviceModule({
      keyPath: args.privateKey,
      certPath: args.clientCert,
      caPath: args.caCert,
      clientId: args.clientId,
      region: args.region,
      baseReconnectTimeMs: args.baseReconnectTimeMs,
      keepalive: args.keepAlive,
      protocol: args.Protocol,
      port: args.Port,
      host: args.Host,
      debug: args.Debug

   var timeout;
   var count = 0;
   const minimumDelay = 250;

   if (args.testMode === 1) {
   } else {
   if ((Math.max(args.delay, minimumDelay)) !== args.delay) {
      console.log('substituting ' + minimumDelay + 'ms delay for ' + args.delay + 'ms...');
   timeout = setInterval(function() {

      if (args.testMode === 1) {
         device.publish('topic_2', JSON.stringify({
            mode1Process: count
      } else {
         device.publish('topic_1', JSON.stringify({
            mode2Process: count
   }, Math.max(args.delay, minimumDelay)); // clip to minimum

   // Do a simple publish/subscribe demo based on the test-mode passed
   // in the command line arguments.  If test-mode is 1, subscribe to
   // 'topic_1' and publish to 'topic_2'; otherwise vice versa.  Publish
   // a message every four seconds.
      .on('connect', function() {
      .on('close', function() {
      .on('reconnect', function() {
      .on('offline', function() {
      .on('error', function(error) {
         console.log('error', error);
      .on('message', function(topic, payload) {
         console.log('message', topic, payload.toString());

         var relay = new five.Relay({
         pin: 5,
         type: "NC"

         if (Number(payload)==1) {
         if (Number(payload)==0) {



module.exports = cmdLineProcess;

if (require.main === module) {
   cmdLineProcess('connect to the AWS IoT service and publish/subscribe to topics using MQTT, test modes 1-2',
      process.argv.slice(2), processTest);

HAVOC - Home Automation With Voice Control



Hardware components:

  • Intel Edison
  • SparkFun Sensor Kit
  • Bluetooth module HC-05
  • Servo (generic)

Hand tools and fabrication machines:

  • USB Camera
  • USB Hub
  • USB Sound Card



In this project we have used Intel Edison to implement home automation with complete voice control. Basically what we mean by this is that we have a normal voice chat kind-off commands like how we speak to one another. This is done using an android apk which uses a STT engine (Speech to Text engine) to recognize what the commands are.

The project consists of 4 sub-systems:

  1. Automation of Lights/Fan : This sub-system mainly deals with automatic switching ON/OFF of lights and fans depending on sensor values. If the light sensor reads a value lesser than a threshold, it automatically switches on the lights. Similarly with fansNow if the user wants to manually switch ON/OFF i.e., to override the system automation, he can just speak to the device through the android app to switch ON/OFF. All he has to say is "Switch on the lights/fans". The phase is not only limited to that sentence. He just needs to makes sure the keyword "Switch ON/OFF" and the device is mentioned.

  2. Security system : In security we have implemented a live video streaming of a camera which follows the person. The camera is mounted on a servo motor (for angular rotations). This system also has 2 PIR (Proximity infrared) sensors attached to it. Basically PIR is a motion sensor. It detects the motion direction (One PIR for left, other for right) and then send that data to Edison to move the camera in that direction. Also instead of storing that data onto a local system we are hosting that data onto a static IP which can be seen on any device (PC/phones/ipads) connected onto the same network as the Edison.We have also added a timer based switching ON of outside porch lights in the evenings even in the absence of the user.

3.Social content; This sub-system mainly deals with the sharing of information. Basically what i mean to say is that you can get updated on any news/sports/stocks or any other genre of that matter by just speaking to the device; like for example "Update me on football" . Edison now goes to the internet and fetches the live news for you. And instead of displaying, it speaks the news to you. This is done using a TTS engine (Text to Speech engine.) The idea is that if the user is tired working late at office, he/she can just sit on the couch and give commands to the device.

Alert: We have added a timer based alarm system which wakes you in the mornings. The system is designed in such a way that it plays the morning prayers when you wake up.

Step 1: Automation of Lights/Fan






The automation involves the switching ON/OFF of lights/fans automatically.

The sensors connected are LDR (Light sensor), temperature sensor. The edison now read these values and switches ON/OFF depending on the values and threshold. If the LDR value is lesser than threshold ==>> Switch ON Lights.

if the temperature value is greater than threshold ==>> Switch ON fans.Now if the user specifically wants to switch ON/OFF the system, all he has to do is speak to the device through the android app - "Android meets robotics." Its available on Google. This will force the system to system to switch ON/OFF depending on what the user wants.

Components used:

  • LDR sensor
  • Temperature Sensor
  • Bluetooth module - HC -05

Step 2: Security System





The security system consists of a camera mounted on a servo with 2 PIR sensors attached to it.The PIR sensors are gonna detect the motion and send that data to Edison. Edison will now force the servo to move the camera in that direction. Thus this gives us a presence detector camera. This also improves the field of view rather than having a static stationary camera.Also the camera data is then streamed live into a static IP address rather than storing it on to a local machine. This gives us the flexibility to access the streaming video with multiple devices.This is done using websocket programming. Refer - edi-cam to see how it works.

The servo and the camera are run on two different scripts.

Apart from this We have also added a clock based system which turns on the outside lights in the evenings. This is done by changing the time of the the Edison board and storing it in a variable and checking continuously using a different script running though SSH.All the codes are run in the Linux part.

Components used:

  • Camera
  • Servo
  • PIR - 2 numbers

Step 3: News Update



This sub-system deals with updating the user on news/sports/stocks or any other genre for that matter. All the user is supposed to do is, speak to the device and let it know you wanna be updated. Like for example "Update me on football" or say "Update me on news" anything what the user wishes to know. (Anything pre-defined in the codes that is.)Edison now gets the data from the internet (URL's of that particular genre to be previously feed in the codes) and downloads the RSS feed. The system then uses TTS engine called "Espeak" to convert the downloaded RSS into a voice output. The output is heard through a speaker connected to Edison using a USB sound card. To set-up the sound card, you can refer to Instructable post click here One major advantage of this home automation system is that the entire process is audio;everything from input to output is in audio format.

Components used:

  • USB Sound card
  • Speaker

Step 4: Alerts/Play music


Basically we have designed this system to be an alarm to wake up early morning. It automatically plays early morning prayers at the time of your wake up. We have designed this by a little change of system time (Setting it to sync with my location) and then storing it in a variable and checking continuously.You can refer here to learn how to play music with your Edison.

Step 5: General block diagrams




Servo Algorithm

Voice Commands Algorithm


Light Algorithm

Web Algorithm

Fan Algorithm


#!/usr/bin/env python
import mraa		#importing mraa
import time		#importing time
import serial		#Importing serial

uart = mraa.Uart(0)	#Initialising Rx and Tx
ser =serial.Serial(uart.getDevicePath(), 9600, timeout=1)		#Initialising serial

x = mraa.Pwm(6)		#declaring pin 6 as pwn output for Servo
x.period_us(1000)	#defining time period
value = 0.0		#Declaring value = 0
while True:
	z = mraa.Aio(5)	#Reading left PIR value
	y = mraa.Aio(4)	#Reading right PIR value

	if >=550:		#If motion detected at Left side

		x.write(0.0)		#Move servo to left
		time.sleep(3)		#Wait for 3 seconds

 	if >=550:		#If motion detected at Right side

			x.write(0.99)		#Move servo to right
			time.sleep(3)		#Wait for 3 seconds

	if (>550)and(>550):	#If motion detected at both left and right
			x.write(0.33)		#move to center
			time.sleep(3)		#Wait for 3 seconds

Mrunali Bawankar

Mrunali Bawankar