Herunterladen Inhalt Inhalt Diese Seite drucken

SunFounder Da Vinci Kit Bedienungsanleitung Seite 142

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
stepsPerRevolution
int
int
stepSpeed
=
0;
void rotary(char
direction){
if(direction
==
for(int
j=0;j<4;j++){
for(int
{digitalWrite(motorPin[i],0x99>>j
delayMicroseconds(stepSpeed);
}
}
else
if(direction =='a'){
for(int
j=0;j<4;j++){
for(int
{digitalWrite(motorPin[i],0x99<<j
delayMicroseconds(stepSpeed);
}
}
}
void
loop()
{
char
direction
while
(1)
{
printf("select motor direction a=anticlockwise, c=clockwise:
delay(100);
direction=getchar();
if
(direction
{
printf("motor running
delay(100);
break;
}
else if
(direction
{
printf("motor running
delay(100);
break;
}
else
{
printf("input error, please try
delay(100);
}
}
while(1)
{
rotary(direction);
}
}
void
main(void)
{
if
(wiringPiSetup()
{
printf("setup wiringPi failed
138
=
2048;
'c'){
i=0;i<4;i++)
i=0;i<4;i++)
=
'0';
==
'c')
clockwise\n");
==
'a')
anti-clockwise\n");
==
-1)
&
(0x08>>i));}
&
(0x80>>i));}
again!\n");
!");
(Fortsetzung der vorherigen Seite)
");
(Fortsetzung auf der nächsten Seite)
Kapitel 1. Über das Da Vinci Kit

Werbung

Inhaltsverzeichnis
loading

Verwandte Produkte für SunFounder Da Vinci Kit

Diese Anleitung auch für:

Davinci-kit-for-raspberry-pi

Inhaltsverzeichnis