Lego Technic of the Past Arduino Library: Difference between revisions
Jump to navigation
Jump to search
| Line 12: | Line 12: | ||
#include "Arduino.h" | #include "Arduino.h" | ||
| Line 19: | Line 19: | ||
public: | public: | ||
#define PORT0_PIN 3 | #define PORT0_PIN 3 | ||
#define PORT1_PIN 5 | #define PORT1_PIN 5 | ||
#define PORT2_PIN 6 | #define PORT2_PIN 6 | ||
#define PORT3_PIN 9 | #define PORT3_PIN 9 | ||
#define PORT4_PIN 10 | #define PORT4_PIN 10 | ||
#define PORT5_PIN 11 | #define PORT5_PIN 11 | ||
#define PORT6_ANALOGPIN 0 | #define PORT6_ANALOGPIN 0 | ||
#define PORT7_ANALOGPIN 1 | #define PORT7_ANALOGPIN 1 | ||
#define PORT_ON HIGH | #define PORT_ON HIGH | ||
#define PORT_OFF LOW | #define PORT_OFF LOW | ||
#define COMBO_OFF 0 | #define COMBO_OFF 0 | ||
#define COMBO_LEFT 1 | #define COMBO_LEFT 1 | ||
#define COMBO_RIGHT 2 | #define COMBO_RIGHT 2 | ||
#define COMBO_BOTH 3 | #define COMBO_BOTH 3 | ||
LegoTechnic(); | LegoTechnic(); | ||
| Line 61: | Line 61: | ||
}; | }; | ||
#endif | #endif | ||
'' | '' | ||
Revision as of 21:58, 16 November 2015
HEADER
/* LegoTechnic.h - Library to run Lego Technic Controller brick with a specific Arduino Shield. Created November 16, 2015 Rights Reserved
- /
#ifndef LegoTechnic_h #define LegoTechnic_h
#include "Arduino.h"
class LegoTechnic
{
public:
#define PORT0_PIN 3 #define PORT1_PIN 5 #define PORT2_PIN 6 #define PORT3_PIN 9 #define PORT4_PIN 10 #define PORT5_PIN 11
#define PORT6_ANALOGPIN 0 #define PORT7_ANALOGPIN 1
#define PORT_ON HIGH #define PORT_OFF LOW
#define COMBO_OFF 0 #define COMBO_LEFT 1 #define COMBO_RIGHT 2 #define COMBO_BOTH 3
LegoTechnic();
LegoTechnic(int P0, int P1, int P2, int P3, int P4, int P5, int P6, int P7);
void Output_Port(int id, int action);
void PWM_Port(int id, int pwm_value);
int Input_Port(int id);
void Combo_Port(char id, int mix);
void PWM_Combo_Port(char id, int mix, int pwm_value);
void Port_Initialize();
int Port_PWM[6] = {255, 255, 255, 255, 255, 255};
void Verbose(int value);
void Parse_Command(String Command);
private:
int _D0,_D1,_D2,_D3,_D4,_D5,_A6,_A7;
int _Verbose = HIGH;
void _Parse_PWM_Command(String Port, String Value);
void _Parse_Verbose_Command(String Value);
void _Parse_CPWM_Command(String Port, String Action, String Value);
void _Parse_Port_Command(String Port, String Action);
void _Parse_Combo_Command(String Port, String Action);
void _Parse_Input_Command(String Port);
void _Display_Commands();
void _Display_PWM_Values();
};
#endif