Skip to content

Instantly share code, notes, and snippets.

View azhaganandhan's full-sized avatar

Azhaganandhan azhaganandhan

  • Talam Auroville
  • Auroville
View GitHub Profile
#include <Wire.h>
void setup() {
// put your setup code here, to run once:
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600);
}
int reading = 0;
@azhaganandhan
azhaganandhan / gist:277be80c301cf1f6fec8cf4e9ae0b37f
Created January 24, 2018 04:23
Pressure convertion code Raw
#include<stdio.h>
#define uint8_t unsigned char
#define uint16_t unsigned int
#define uint32_t unsigned int
int main() {
int x=33;
int y=125;
int z=151;
uint32_t SenAD;
@azhaganandhan
azhaganandhan / gist:ea494fabe496e2f29dd269d8c2dfb457
Created January 25, 2018 11:11
Working stepper motor with photodetector
int Horizontal = 0; // set to home position
#include <Stepper.h>
const int stepsPerRevolution = 512;
Stepper Vstepper(stepsPerRevolution, 8, 9, 10, 11);
Stepper Ystepper(stepsPerRevolution, 1, 2, 3, 4);
// LDR
/*
10bit Absolute Encoder Gray code decoder Example
Codding by www.thaiconverter.com
The code is Free of use, feel free to use it ;)
We will happy if you use our code to make our World better.
*/
boolean pin_state[10];
byte input_pin[] = {2,3,4,5,6,7,8,9,10,11}; // Config Pins Input Here bit-1 to 10
int dec_position = 0;
// include stepper library
#include <Stepper.h>
const int stepsPerRevolution = 200; // Nema17 motor has 200 steps in 360 degrees rotation
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11); // pins 8,9 go to PULL+ & PULL- , pins 10,11 go to DIR+ & DIR-
Stepper youStepper(stepsPerRevolution, 2, 3, 4, 5); // pins 8,9 go to PULL+ & PULL- , pins 10,11 go to DIR+ & DIR-
int tracknumber = 2; // SET HOW MANY TRACKS YOU WANT UP AND BACK
#include <Stepper.h>
char incomingByte;
const int stepsPerRevolution = 2000;
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
Stepper youStepper(stepsPerRevolution, 2, 3, 4, 5);
void setup() {
myStepper.setSpeed(800);
Serial.begin(9600);
}
#include <Stepper.h>
char incomingByte;
const int stepsPerRevolution = 2000;
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
Stepper youStepper(stepsPerRevolution, 2, 3, 4, 5);
void setup() {
myStepper.setSpeed(800);
Serial.begin(9600);
}
#include <Stepper.h>
char incomingByte;
const int stepsPerRevolution = 2000;
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
Stepper youStepper(stepsPerRevolution, 2, 3, 4, 5);
void setup() {
myStepper.setSpeed(800);
Serial.begin(9600);
}
#include <Stepper.h>
char incomingByte;
const int stepsPerRevolution = 2000;
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
Stepper youStepper(stepsPerRevolution, 2, 3, 4, 5);
void setup() {
myStepper.setSpeed(800);
Serial.begin(9600);
}
#include <Stepper.h>
char incomingByte;
const int stepsPerRevolution = 2000;
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
Stepper youStepper(stepsPerRevolution, 2, 3, 4, 5);
void setup() {
myStepper.setSpeed(800);
Serial.begin(9600);
}