Project

General

Profile

Revision 0c873a67

ID0c873a678934d3644224359dbebdfcb750af3f9a
Parent c5d6b0e8
Child 453e1532

Added by Matthew Sebek about 10 years ago

Fixed up all the buggy code.

View differences:

arduino/RCbuggyMega/brake.c
1
/**
2
 * @file brake.c
3
 * @author Audrey Yeoh (ayeoh)
4
 * @author Matt Sebek (msebek)
5
 */
1 6
#include <Arduino.h>
2 7
#include "brake.h"
3 8

  
4
static int pin;
9
static int brake_pin;
10
// Indicator LED pin number
11
static int indicator_pin;
5 12

  
6
void brake_init(int brakePin, int ledPin) {
7
	brake = brakePin;
8
	led = ledPin;
13
void brake_init(int brakePin, int indicatorLed) {
14
  pinMode(brake_pin, OUTPUT);
15
  pinMode(indicatorLed, OUTPUT);
16
  brake_pin = brakePin;
17
  indicator_pin = indicatorLed;
9 18
}
10 19

  
11
void raiseBrake(){
12
	digitalWrite(brake, 1);
13
	digitalWrite(led, LOW);
20
// Note: High-voltage raises the brake.
21
// Raises the brake
22
// Do not call before brake_init
23
void brake_raise() {
24
  digitalWrite(brake_pin, HIGH);
25
  digitalWrite(indicator_pin, LOW);
14 26
}
15 27

  
16
void dropBrake(){
17
	digitalWrite(brake, 0);
18
	digitalWrite(led, HIGH);
28
// Drops the brake
29
// Do not call before brake_init
30
void brake_drop() {
31
  digitalWrite(brake_pin, LOW);
32
  digitalWrite(indicator_pin, HIGH);
19 33
}
20

  
21

  

Also available in: Unified diff