Show Posts
Pages: [1]
1  Using Arduino / Audio / Re: How can I control audio volume with Arduino? on: May 05, 2013, 01:57:03 am
Hey Jomn. I was in the same boat as you. I opted for a PT2257 to control the volume for a project I have on the go at the moment.

Great way of learning, read the datasheets.
Build the example circuits that most datasheets have, on a breadboard.

It was a bit unfortunate that I couldn't find a lib for the PT2257. So I wrote one myself, which was another challenge for a newbie. (To be honest it's not complete, but it functions for my needs.)

There are some good tutorials here....http://tronixstuff.wordpress.com/2010/10/20/tutorial-arduino-and-the-i2c-bus/

Good luck with your project. It will be frustrating at times, but when you have a working example, you get a great feeling. Then you move onto the next part & start the process again.
2  Using Arduino / Displays / Re: How to use this PCF8574 board from "emall-4u" on: March 23, 2013, 11:38:35 am
Quote
The chip on the "emall-4u I2C" says PCF8574T.

Not sure what else to give you..
Did you read the stuff above the point where you joined the thread, about the I2C address?


Quote
Edit: Well, if i try to post images the page doesn't even want to try if i hit post....
What technique did you try?

Don

Have you declared the address elswhere?

Code:
/*-----( Import needed libraries )-----*/
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>  // F Malpartida's NewLiquidCrystal library
//Download: https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
// Move original LiquidCrystal library elsewhere, copy this in it's place

/*-----( Declare Constants )-----*/
#define I2C_ADDR    0x20  // Define I2C Address for the PCF8574A
//---(Following are the PCF8574 pin assignments to LCD connections )----
// This are different than earlier/different I2C LCD displays
#define BACKLIGHT_PIN  7
#define En_pin  4
#define Rw_pin  5
#define Rs_pin  6
#define D4_pin  0
#define D5_pin  1
#define D6_pin  2
#define D7_pin  3

#define  LED_OFF  0
#define  LED_ON  1

/*-----( Declare objects )-----*/ 
LiquidCrystal_I2C  lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
3  Using Arduino / Displays / Re: Strange Character on LCD when using bash to send over serial on: March 21, 2013, 12:32:26 pm
Could it be a LF/CR? I noticed the same when I tried a serial lcd test.
Try turning them on, in your IDE & see if you get the same result.
4  Community / Exhibition / Gallery / Re: Alarm clock w/ light control (w/ touch backlight panel) on: March 11, 2013, 03:17:55 pm
Thanks for sharing, very impressive  smiley
5  Using Arduino / Project Guidance / Re: Arduino MEGA Pinout Diagram on: February 02, 2013, 11:48:44 am
Thanks again.
6  Using Arduino / Project Guidance / Re: Arduino UNO Pinout Diagram on: February 01, 2013, 12:58:04 pm
Thanks, very handy  smiley
7  Using Arduino / Audio / Re: Play Taps (Musical Piece Played at Military Funerals) on 8ohm Speaker! on: January 21, 2013, 02:03:58 pm
Hi,

I was looking at something similar today... You could try modifying the tone example with the following.. The notes are correct, but the timings are rough.

Code:
/*
  Melody
 
 Plays a melody
 
 circuit:
 * 8-ohm speaker on digital pin 8
 
 created 21 Jan 2010
 modified 30 Aug 2011
 by Tom Igoe

This example code is in the public domain.
 
 http://arduino.cc/en/Tutorial/Tone
 
 */
 #include "pitches.h"

// notes in the melody:
int melody[] = {
  NOTE_G4, NOTE_G4, NOTE_C5, NOTE_G4, NOTE_C5, NOTE_E5, NOTE_G4, NOTE_C5, NOTE_E5, NOTE_G4, NOTE_C5, NOTE_E5, NOTE_G4, NOTE_C5, NOTE_E5, NOTE_C5, NOTE_E5, NOTE_G5, NOTE_E5, NOTE_C5, NOTE_G4, NOTE_G4, NOTE_G4, NOTE_C5};

// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
  2,2,1,2,2,1,2,2,2,2,2,2,2,2,1,2,2,1,2,2,1,2,2,1};

void setup() {
  // iterate over the notes of the melody:
  for (int thisNote = 0; thisNote < 24; thisNote++) {

    // to calculate the note duration, take one second
    // divided by the note type.
    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
    int noteDuration = 1000/noteDurations[thisNote];
    tone(8, melody[thisNote],noteDuration);

    // to distinguish the notes, set a minimum time between them.
    // the note's duration + 30% seems to work well:
    int pauseBetweenNotes = noteDuration * 1.30;
    delay(pauseBetweenNotes);
    // stop the tone playing:
    noTone(8);
  }
}

void loop() {
  // no need to repeat the melody.
}
Pages: [1]