Skip to content

Introduction to the basics of programming hardware using the Viam SDK by making an LED blink.

License

Notifications You must be signed in to change notification settings

viam-labs/LED-Blink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LED-Blink

This project introduces the basics of programming hardware using the Viam SDK by making an LED blink. This will allow you to write Python or Golang code to make an LED connected to the GPIO of a Raspberry Pi blink. This tutorial is a good introduction to Python programming, and developing code for hardware like robots and IoT devices.

Check out the full tutorial on the Viam documentation site.

A GIF of the completed project showing a blinking blue LED connected to a Raspberry Pi with jumper cables.

Circuit Diagram

For reference, the circuit you are building for this tutorial looks like this:

Circuit diagram showing a Raspberry Pi with a red connector running out of GPIO pin 8 to a 100-ohm* resistor*. The resistor is connected to the long lead of a red LED bulb. Finally, a blue connector connects the short lead of the LED to the ground connection on pin 6 of the Raspberry Pi GPIO pins.

Prerequisites

You will need the following hardware, tools, and software to complete this project:

Hardware

Software

Installation

  1. Install Viam Server on your Raspberry Pi.

  2. Clone this repo onto your development machine:

git clone git@github.com:viam-labs/LED-Blink.git
  1. Set up your Raspberry Pi and LED. See How to Make an LED Blink with a Raspberry Pi and the Viam SDK for details.

Python

  1. Install Viam Python SDK on your computer.

  2. Update the payload and address information in blink.py. You can your information from the CONNECT tab of the Viam App.

  3. Run your code!

python3 python/blink.py

Go

  1. Install Viam Go SDK on your computer.

  2. Update the payload and address information in blink.go. You can your information from the CONNECT tab of the Viam app.

  3. Change directory to the go directory.

cd go
  1. Run your code!
go run blink.go

Contributing TLDR

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License