Showing posts with label Weekday Project. Show all posts
Showing posts with label Weekday Project. Show all posts

November 27, 2017

Weekday Arduino Project #2

Decode IR Remote Buttons

The Project:
Decode the signals from an IR remote to use in other projects.

Pictures:

Why?:
For later projects, and to decode any of your IR remotes for later usability.

What you need:
  1. Arduino Uno Board
  2. 3 pin IR receiver
  3. IR remote
  4. Breadboard
  5. Arduino software

The Schematic:

The Code:
// Include all needed libraries
#include <IRLib.h>
#include <IRLibMatch.h>
#include <IRLibRData.h>
#include <IRLibTimer.h>

// Create a receiver object to listen on pin 11
IRrecv My_Receiver(6);

// Create a decoder object
IRdecode My_Decoder;

void setup()
{
  Serial.begin(9600);
  My_Receiver.enableIRIn();   // Start the receiver
}

void loop() {
// Continuously look for results. When you have them pass them to the decoder
  if (My_Receiver.GetResults(&My_Decoder)) {
    My_Decoder.decode();   // Decode the data
    My_Decoder.DumpResults(); // Show the results on serial monitor
    My_Receiver.resume(); // Restart the receiver
  }

}

The Library:
Feel free to contact me if you have any questions!


November 20, 2017

Weekday Arduino Project #1

LCD Screen Reads Out Servo Angle

The Project:
Create an Arduino project that steadily increases the angle of a servo, and prints the angle on an LCD screen.

Pictures:
Why?:
This is a tester for a long-term project that I am working on currently.

What you need:

  1. Arduino Uno board
  2. 16 pin 16x2 LCD screen
  3. 3 pin servo
  4. 10k ohm potentiometer
  5. 220 ohm resistor
  6. Breadboard
  7. Arduino software
The Schematic:

The Code:
// Include the library code:

#include <LiquidCrystal.h>
#include <Servo.h>

// Initialize the library by associating any needed LCD interface pin
// With the arduino pin number it is connected to
// Const ints
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
const int numRows = 2;
const int numCols = 16;

// Ints
int potpin = 0;
int val;
int count  = 0;

// Create servo object to control servo
Servo myservo;

// Set up LCD display
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
 // Set up the LCD's number of columns and rows:
 lcd.begin(numCols, numRows);
 Serial.begin(9600);
 myservo.attach(9);
}

Void loop(){
 // Refresh the display
 lcd.clear();
 lcd.display();
 // Set display
 lcd.setCursor(0,0);
 
 // Math for Servo
 count = (count + 1);
 Serial.print(count);
// Reset counter if it reaches 1000
 if (count == 1000){
   count = 0;
}
 // Convert and write to servo
 val = map(count,0,1000,0,180);
 myservo.write(val);
 
 // Print angle on LCD
 lcd.print(val);
 delay(50);
}

Feel free to contact me if you have any questions!