Intel® Makers
Intel® Edison, Intel® Joule™, Intel® Curie™, Intel® Galileo
Welcome - This is a Peer-to-Peer Forum only. Intel has discontinued these products but you may find support from other customers on this Forum
9872 Discussions

Blinking an LED with Galileo Gen 2 and Python

Community Manager

With embedded widgets blinking an LED is the equivalent of "Hello World". I could not find an example of using python to blink an LED here so I thought I would share this. Hopefully this will save someone some time when they want to blink an LED using MRAA and Python. I have only used/tested this with the Galileo Gen 2 built with the EGLIBC image:

0 . First is to install mraa

opkg update

opkg install mraa

1. Next you open python and import MRAA.

import mraa

2. Then initialize the pin, in this example I am using digital pin 12.

pin = mraa.Gpio(12)

3. Next set the pin to output mode.


4. And then set it high or low to turn it on or off.


All together in one script using digital pin 12 and blinking on/off ever second.

# !/usr/bin/env python

import mraa

import time


pin = mraa.Gpio(12)


while True:





It is just that easy!

You can download a script here that does it all for you : GitHub - joemcmanus/led: Intel Galileo LED python script


root@galileo:~# ./ 1

Blinking LED 1

Using delay 10 and for 0 attempts

Turning LED 1 on, for 10 seconds, count 0.

root@galileo:~ ./ --help

usage: [-h] [--count COUNT] [--delay DELAY] [--version] pinNumber

Simple LED Blinker for Galileo

positional arguments:

pinNumber Specify the pin number, i.e. 0-13

optional arguments:

-h, --help show this help message and exit

--count COUNT Number of times to execute, default infinity

--delay DELAY Number of seconds to wait between blinkings, default 10

--version show program's version number and exit



0 Replies