-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiplexorHandler.cpp
More file actions
35 lines (29 loc) · 909 Bytes
/
MultiplexorHandler.cpp
File metadata and controls
35 lines (29 loc) · 909 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
/*
InputManager.h - Library for listening Serial Port and represent the word from it.
Created by Blindle, 17 September, 2017.
Released into the public domain.
*/
#include "Arduino.h"
#include "MultiplexorHandler.h"
int DELAY_BETWEEN_MOTOR_STEPS = 1;
int NO_DATA = 0;
MultiplexorHandler::MultiplexorHandler(int latchPin, int clockPin, int dataPin)
{
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
_latchPin = latchPin;
_clockPin = clockPin;
_dataPin = dataPin;
}
void MultiplexorHandler::sendMultiplexorData(int data)
{
digitalWrite(_latchPin, LOW);
shiftOut(_dataPin, _clockPin, LSBFIRST, data);
digitalWrite(_latchPin, HIGH);
delay(DELAY_BETWEEN_MOTOR_STEPS);
digitalWrite(_latchPin, LOW);
shiftOut(_dataPin, _clockPin, LSBFIRST, NO_DATA);
digitalWrite(_latchPin, HIGH);
delay(DELAY_BETWEEN_MOTOR_STEPS);
}