46 lines
1.4 KiB
Markdown
46 lines
1.4 KiB
Markdown
Scratch examples for GrovePi
|
|
============================
|
|
|
|
These are simple examples meant to illustrate how you can access GrovePi features through Scratch.
|
|
|
|
## 1. Simple LED: led_on_port_7 :
|
|
|
|
Plug any GrovePi LED onto Port 7 and run this Scratch script.
|
|
|
|
Click on the LED (on the screen) to control the physical LED
|
|
|
|
Click on Dex to turn the LED on for 2 seeconds and then it will turn off automatically
|
|
|
|
Click on the letter B on your keyboard to generate a blinking LED
|
|
|
|
Both the physical LED and the Scratch LED should react together
|
|
|
|
## 2. two_tone_buzzer :
|
|
|
|
Plug the buzzer in port 5
|
|
|
|
Move the ball around. When it hits the leg a low buzz will be emitted. When it hits the head, a low buzz will be heard
|
|
|
|
## 3. two_buttons_in_parallel :
|
|
|
|
Put a button in port 2 and another one in port 3.
|
|
|
|
Press the first button (in port 2). Dex will wave
|
|
|
|
Press the second button (in port 3). Dex will rotate.
|
|
|
|
## 4. LCD screen :
|
|
|
|
Put LCD screen in any of the I2C ports
|
|
|
|
Clicking on any of the six coloured circles will change the background colour of the LCD screen (and change the colour of the sunglasses)
|
|
|
|
Clicking on any of the four text buttons in the corners will display that text (and have Dex say the selected text)
|
|
|
|
Clicking on Dex will have Dex ask you your name, and then display it on the LCD screen
|
|
|
|
## 5. Rotary sensor:
|
|
|
|
Plug the rotary sensor into port A0
|
|
|
|
Click on the Green flag and use the rotary sensor to move Dex left to right
|