Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Put these into the Loop function
- //Vibrate on breaking
- breakingVibrator(throttle);
- //Alert user on connection loss
- connectionAlert();
- //Functions
- void connectionAlert()
- {
- if(connected == false && triggerActive())
- {
- analogWrite( 6 , 255 );
- delay(75);
- analogWrite( 6 , 0 );
- delay(10);
- }
- }
- void breakingVibrator(int power)
- {
- int v;
- int minimumTreshold = 35;
- v = map(power, 0, 512, 255, 30);
- if (v > minimumTreshold && ratioRpmSpeed * returnData.rpm > 1)
- {
- analogWrite( 6 , constrain(v, 0, 255));
- }
- else
- {
- analogWrite( 6 , 0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement