This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ARDUINO six-steps PSEUDOCODE FOR 3-AXIS SENSORS ADXL345 | |
#include <Wire.h> | |
/* | |
ADXL345 Datasheet: https://goo.gl/uOZc2b | |
Table 16. Register Map Address | |
Hex Dec Name Type Reset_Value Description | |
0x2D 45 POWER_CTL R/W 00000000 Power-saving features control. | |
(...) | |
0x32 50 DATAX0 R 00000000 X-Axis Data 0. | |
0x33 51 DATAX1 R 00000000 X-Axis Data 1. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <LiquidCrystal.h> | |
// LiquidCrystal (RS, E, d4, d5, d6, d7) | |
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // For standalone, non-shield, LCD | |
int ms1Pin = A0; // Stepstick MS0 to Arduino digital pin 9 | |
int ms2Pin = A1; // Stepstock MS1 to Arduino digital pin 10 | |
int ms3Pin = A2; // Stepstick MS2 to Arduino digital pin 11 | |
int stepPin = A3; // Stepstick STEP pin to Arduino digital pin 12 | |
int dirPin = A4; // Stepstick DIR pin to Arduino digital pin 13 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// include the library code: | |
#include <LiquidCrystal.h> | |
// initialize the library with the numbers of the interface pins | |
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); | |
void setup() { | |
// set up the LCD's number of columns and rows: | |
lcd.begin(16, 2); | |
// Print a message to the LCD. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define DIR 2 | |
#define STEP 3 | |
#define BUTTON A0 | |
#define M0 4 | |
#define M1 5 | |
#define M2 6 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define DIR 2 | |
#define STEP 3 | |
#define BUTTON A0 | |
#define M0 4 | |
#define M1 5 | |
#define M2 6 | |
int dPause = 100; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define DIR 2 | |
#define STEP 3 | |
#define BATT A0 | |
#define M0 4 | |
#define M1 5 | |
#define M2 6 | |
#define _TRUE 1 | |
#define _FALSE 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> // I2C library | |
//-------- REGISTER MAP for ADXL345 chip -----// | |
#define ACC (0x53) // ADXL345 ACC address | |
#define POWER_CTL (0x2D) // Power-saving features control | |
#define DATA_FORMAT (0x31) // Data format control | |
#define BW_RATE (0x2C) // Data rate and power mode control | |
#define DATAX0 (0x32) // First address for axis x | |
#define A_TO_READ (6) // num of bytes we are going to read each time | |
// two bytes for each axis |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Servo.h> // include Servo library | |
Servo horizontal; // horizontal servo | |
int servoh = 90; // stand horizontal servo | |
Servo vertical; // vertical servo | |
int servov = 90; // stand vertical servo | |
// LDR pin connections | |
// name = analogpin; | |
int ldrlt = 0; //LDR top left | |
int ldrrt = 1; //LDR top rigt | |
int ldrld = 2; //LDR down left |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
J3BCP Testing the bytes that come from Arduino. | |
Run this code on Arduino Pro Mini | |
see webpage: https://goo.gl/4zmgGK | |
*/ | |
char data; | |
void setup() { | |
Serial.begin(9600); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <osa.h> | |
// Config TIMER2 @ 1 ms (FOSC = 8MHz) | |
/* | |
1.000 = P_cycleMachine * Prescaler * Postscale * (PR2 + 1) | |
1.000 = 0.5us * 4 * 10 * (PR2 + 1) //1:10 Postscaler | |
PR2 = 49 //Prescaler is 4 | |
*/ | |
#define T2CON_CONST 0B01001101 //Timer2 ON, Prescaler 1:4 e Postscale 1:10 | |
#define PR2_CONST (49) //1us for FOSC |