forked from uArm-Developer/SwiftProForArduino
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGroveControl.cpp
More file actions
46 lines (39 loc) · 808 Bytes
/
GroveControl.cpp
File metadata and controls
46 lines (39 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*******************************************
/*******************************************
/***@file GroveControl.cpp
/***@author LUYU
/***@email yu.lu@ufactory.cc
/***@date 20170905
/*******************************************
*******************************************/
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include "GroveControl.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
GroveControl::GroveControl()
{
}
void GroveControl::setPin(int pin)
{
_pin = pin;
}
void GroveControl::off(void)
{
pinMode(_pin, OUTPUT);
digitalWrite(_pin, LOW);
}
void GroveControl::on(void)
{
pinMode(_pin, OUTPUT);
digitalWrite(_pin, HIGH);
}
void GroveControl::speed(uint8_t speed)
{
pinMode(_pin, OUTPUT);
analogWrite(_pin, speed);
}