Git Product home page Git Product logo

iot-blink-v2's Introduction

IoT-Blink (blink.js)

Simple Blink Example using Raspberry Pi, LED Light and Ethereum (web3 1.0.0)

Versions and Dependencies

  • ganache-cli v6.1.8
  • Node v8.9.0
  • npm v5.5.1
  • web3 v1.0.0-beta.36
  • onoff v1.1.2
  • truffle v4.1.13

Installation & Starting

Installation

Before doing anything make sure the breadboard and LED are correctly connected to the Raspberry Pi. Make note of the GPIO pin being used. Once you have cloned the repo make sure to install the package.json dependencies. From inside the IoT-Blink directory run:

`npm i`
  1. In one terminal window initialise ganache-cli:

    ganache-cli

  2. In another terminal window change directory to IoT-Blink

  3. Navigate to the truffle directory

    cd truffle

  4. Compile the solidity contracts

    truffle compile

  5. Migrate the solidity contracts

    truffle migrate

  6. Copy the contract address, the line printed in the terminal should read:

    Blink: ...<contract adddress>

  7. Open blink.js in any text editor and replace the following line with the LEDs GPIO pin number:

    var led = new Gpio(<PIN NUMBER>, 'out')

Running

  1. Run blink.js, passing the contract address with the address from step 6 in the previous section in place of ADDRESS:

    node blink.js ADDRESS
    
  2. In another terminal window run transaction.js, replacing the contract address as in the previous step:

    node transaction.js ADDRESS

  3. The LED should begin to blink!

iot-blink-v2's People

Contributors

crnbarr93 avatar

Watchers

 avatar

iot-blink-v2's Issues

Transaction.js

Can this log to console once transaction has successfully been sent and then can we get this to exit and close process once transaction has been sent?

UX would be: user types in 'node transaction.js [contract addy]', console logs 'coinbase...' - 'transaction sending' - 'transaction sent', user returned to bash shell.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.