Herunterladen Inhalt Inhalt Diese Seite drucken

SunFounder Da Vinci Kit Bedienungsanleitung Seite 436

Für den raspberry pi 4 modell b, 3 modell a +, 3 modell b +, 3 modell b, 2 modell b, 1 modell b +, 1 modell a +, zero w and zero
Inhaltsverzeichnis

Werbung

SunFounder Da Vinci Kit
Skizzieren
import processing.io.
// Define an instance of the Dot object
Dot myDot;
// Define the pins that will be reading button presses
int[] pins
=
{ 18, 23,
void
setup() {
size(400, 400);
// Change the color mode of the sketch to HSB
colorMode(HSB, 360, 100, 100);
noStroke();
for (int
i
=
0; i
GPIO.pinMode(pins[i], GPIO.INPUT_PULLUP);
}
// Create a Dot in the middle of the screen
myDot
=
new
Dot(width
}
void
draw() {
background(0);
// Modify attributes of the Dot depending on which buttons are pressed
if
(GPIO.digitalRead(pins[0])
if
(GPIO.digitalRead(pins[1])
if
(GPIO.digitalRead(pins[2])
// Update the Dot state
myDot.update();
// And draw it to the screen
myDot.show();
432
;
*
24
};
<
pins.length; i++) {
/
2,
height
/
==
GPIO.LOW) {myDot.setSize();}
==
GPIO.LOW) {myDot.setPosition();}
==
GPIO.LOW) {myDot.setColor();}
2, 100, 255);
(Fortsetzung auf der nächsten Seite)
Kapitel 1. Über das Da Vinci Kit

Werbung

Inhaltsverzeichnis
loading

Diese Anleitung auch für:

Davinci-kit-for-raspberry-pi

Inhaltsverzeichnis