Tutorialarduino

Posted : admin On 8/21/2021

#define encoderDT 2
#define encoderCLK 3 // Interrupt
#define encoderSW 4
int previousDT;
int previousCLK;
int previousSW;
void setup()
{
Serial.begin(9600);
pinMode(encoderDT, INPUT_PULLUP);
pinMode(encoderCLK, INPUT_PULLUP);
pinMode(encoderSW, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(encoderCLK), doEncoder, CHANGE);
previousDT = digitalRead(encoderDT);
previousCLK = digitalRead(encoderCLK);
previousSW = digitalRead(encoderSW);
}
int encoderPos = 0;
int previousEncoderPos = 0;
void loop()
{
int actualSW = digitalRead(encoderSW); // Without debouncing
if (actualSW != previousSW)
{
Serial.print('SW= ');
Serial.println(actualSW);
previousSW = actualSW;
}
if(encoderPos > previousEncoderPos)
{
Serial.print(actualSW);
Serial.print(' ');
Serial.print(encoderPos);
Serial.println(' CW');
}
if(encoderPos < previousEncoderPos)
{
Serial.print(actualSW);
Serial.print(' ');
Serial.print(encoderPos);
Serial.println(' CCW');
}
previousEncoderPos = encoderPos;
// delay(1000);
delay(40);
}
void doEncoder()
{
int actualCLK = digitalRead(encoderCLK);
int actualEncoderDT = digitalRead(encoderDT);
if ((actualCLK 1) and (previousCLK 0))
{
if (actualEncoderDT 1)
encoderPos--;
else
encoderPos++;
}
if ((actualCLK 0) and (previousCLK 1))
{
if (actualEncoderDT 1)
encoderPos++;
else
encoderPos--;
}
previousCLK = actualCLK;
}

Windows 8 to usb rufus

Tutorial arduino lcd 16x2Tutorial

Arduino Commands List

Tutorial arduino pdf

Tutorial Arduino Esp8266

A 74HC595 Shift Register is a 16 Pin SIPO IC. SIPO stands for Serial In and Parallel Out which means that it takes input serially one bit at a time and provides output parallelly or simultaneously on all the output pins. In this tutorial we will be building a motion alarm system. The RCWL-0516 is a motion detection sensor. It can detect motion through doppler microwave technology through walls or other materials. Tutorial - Arduino Programming in C Published Jan 05, 2020 Arduino is an open-source hardware and software company, project and user community that designs and manufactures single-board microcontrollers and microcontroller kits for building digital devices. (Buy Arduino Starter Kit. Please subcribe and like for support usFor more info please comment feel free ^^Link Downloadhttps://drive.google.com/open?id=1Zv485GIQe0alS1sx4Gsnu5Sm2Njt.