Datasheet
6
int onSpeed = 200; // a number between 0 (stopped) and 255 (full speed)
int onTime = 2500;
int offSpeed = 50; // a number between 0 (stopped) and 255 (full speed)
int offTime = 1000;
analogWrite(motorPin, onSpeed);
delay(onTime);
analogWrite(motorPin, offSpeed);
delay(offTime);
}
void motorAcceleration()
{
int delayTime = 50;
for(int i=0; i<256; i++)
{
analogWrite(motorPin, i);
delay(delayTime);
}
for(int i=255; i>=0; i--)
{
analogWrite(motorPin, i);
delay(delayTime);
}
}
With Raspberry Pi
1. You should have got a raspberry pi and a grovepi or grovepi+.
2. You should have completed configuring the development enviroment, otherwise follow here.
3. Connection.
Plug the sensor to grovepi socket D6 by using a grove cable.
4. Navigate to the demos' directory:
cd yourpath/GrovePi/Software/Python/
To see the code
nano grove_mosfet.py # "Ctrl+x" to exit #
import time
import grovepi