GrovePi Qhell

Hi, I’m a noob ! I just received my GrovePi anh i had connected a LED in D4. now I want to switch on and off my LED without a big script: just with the shell like with the GPIO: “gpio write D4 1” something like this.

So how do it ?

Thanks !

Hi,
This is the smallest the Switch on and Off can be for a LED on the GrovePi:

from grovepi import *
led = 4
pinMode(led,"OUTPUT")
digitalWrite(led,1)
digitalWrite(led,0)

You can use the Python Interpreter to run it, or modify it slightly to accept arguments from the command line to change the state.

There is not support directly from the command line because the GrovePi relies on a few python libraries, though it is possible to make a small script which can be made to run as a command.

-Karan