Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 21
61  Using Arduino / LEDs and Multiplexing / Re: arduino mega an lcd trouble noob needs advice on: February 22, 2013, 04:35:58 pm
This is a working test sketch that I use with my SainSmart I2C LCD  The only variable may be that your I2C address may be 0X27 instead of 0X3F.  The I2C scanner here http://playground.arduino.cc/Main/I2cScanner will tell you the correct address.

Code:
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

#define I2C_ADDR    0x3F  // Define I2C Address where the PCF8574A is
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7


LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup()
{
  lcd.begin (20,4);
  
// Switch on the backlight
  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.home ();                   // go home

  lcd.print("If you can read this");  
  lcd.setCursor ( 0, 1 );        // go to the 2nd line
  lcd.print("Your LCD is working!");
  lcd.setCursor ( 0, 2 );        // go to the third line
  lcd.print("Congratulations!");
  lcd.setCursor ( 0, 3 );        // go to the fourth line
  lcd.print("Enjoy your I2C LCD");
}

void loop()
{
  // Backlight on/off every 3 seconds
  lcd.setCursor (14,3);        // go col 14 of line 3
  lcd.setBacklight(LOW);      // Backlight off
  delay(3000);
  lcd.setBacklight(HIGH);     // Backlight on
  delay(3000);
}
62  Using Arduino / Project Guidance / Re: arduino +100Mhz radio jammer on: February 22, 2013, 04:09:34 pm
The FCC regulations preempt ANY state attempt at regulating federally licensed communications systems.  You are being fed patently false information that your state/city/county/dog catcher/mayor or ANY other entity can regulate federally licensed communications systems.

As for your failed attempt at equating marijuana laws, I will just leave this here for your perusal http://www.sbsun.com/ci_22532373/authorities-raiding-multiple-san-bernardino-medical-marijuana-dispensaries

Good luck with your jammer.  I'll be watching the FCC enforcement logs for when you get your arse handed to you for using a jammer.  BTW, the fines START at $10,000 PLUS jail time.
63  Using Arduino / Sensors / Re: bmp085 + pro mini 328 on: February 22, 2013, 12:53:52 pm
It's in the code.  It's prints the results to the serial monitor at 9600 baud in the Arduino IDE:

Code:
void loop() {
    Serial.print("Temperature = ");
    Serial.print(bmp.readTemperature());
    Serial.println(" *C");
 
    Serial.print("Pressure = ");
    Serial.print(bmp.readPressure());
    Serial.println(" Pa");
64  Using Arduino / Sensors / Re: bmp085 + pro mini 328 on: February 22, 2013, 11:49:02 am
First make sure that you have not powered the BMP085 with 5 volts.  If you did, it's time to buy another one.
Second, once you know that you have a good BMP085, try just using it with the serial monitor to make sure that it's working properly all by itself.
Third, test your LCD with the Hello World example, and make sure that it's working on it's own as well.
Fourth, once you have verified that both of your components are functioning stand alone, you can then work on integrating them.
65  Using Arduino / Project Guidance / Re: Arduino MEGA Pinout Diagram on: February 22, 2013, 10:45:37 am
Thank you very much!
Any plans to work on other variants of the Mega2560 such as the Seeeduino Mega that break out the extra pins?
66  Using Arduino / General Electronics / Re: Backside of Arduino on: February 20, 2013, 03:04:25 pm
I use this to hold my Arduino Mega and my Seedunio Mega http://www.ponoko.com/design-your-own/products/arduino-mega-mount-5044

They also make a couple for the Uno http://www.ponoko.com/design-your-own/products/arduino-mount-large--4878  
http://www.ponoko.com/design-your-own/products/arduino-mount-standard--4853
67  Community / Products and Services / Re: Introducing Q-kits and more from Aztec MCU Prototyping on: February 20, 2013, 11:10:26 am
My point was that there are dozens of sites where someone can purchase the same items at far less cost than Aztec offers.  I used Mouser as an example because they are normally thought of as an expensive option for components, and yet they beat Aztec's price in this particular area.  If Aztec wants to succeed, the should revisit their pricing and shipping policies.  I would much rather give my money to an independent business than to a large corporation, but not when the price differential is that great (approximately 20% higher).  If I can purchase single quantities of parts cheaper than Aztec sells them for, then they need to find a new supplier for their bulk purchases.
68  Community / Products and Services / Re: Introducing Q-kits and more from Aztec MCU Prototyping on: February 20, 2013, 02:41:05 am
This is meant as constructive criticism, not bashing. I am all for more companies carrying electronics components, but some of  your component prices and shipping charges seem a bit high.  $2.50 for an LM35 PLUS $5 to ship it for a total of $7.50? I can buy an LM35 from Mouser WITH shipping for $6.20 total.  Once your shipping charges are factored in, your prices are not competitive at all.  I think if you get your shipping charges in line you would be much more successful.
69  Using Arduino / Programming Questions / Re: I2C instead of serial on: February 19, 2013, 12:47:47 pm
That worked perfectly, thank you!  Always a good day when I get help making something work and learn why in the process.
70  Using Arduino / Programming Questions / Re: I2C instead of serial on: February 19, 2013, 10:15:00 am
Yes, lcd.print("Hello, world!"); works just fine.  I will make the changes that you recommend and let you know how it goes.  Thank you.
71  Using Arduino / Programming Questions / RESOLVED I2C instead of serial on: February 18, 2013, 11:56:13 pm
Hello,

I am trying to port print commands for a serial LCD to an I2C LCD.  Here is the code I am using that has the serial LCD print commands.  I need to know how to print the results using an I2C LCD using the LiquidCrystal_I2C library.  I know how to #include the libraries for the I2C, I just do not know how to convert the LCD printing related commands such as "sprintf(databuff,"CV:%3d Cnm:%3d",sensorValueTest,i);" to print to my I2C LCD.  Replacing the sprintf with lcd.print obviously does not work.

Code:
#include <EEPROM.h>
#include <SoftwareSerial.h>

//Set up the Liquid Crystal Display  
#define LCDIn 3
#define LCDOut 2
SoftwareSerial mySerialPort(LCDIn, LCDOut);

//LCD Display buffers
char databuff[16];
char dispbuff[16];

// Variables needed for RGB calculations
float Gamma = 1.00;
int MaxIntensity = 255;
float fBlue;
float fGreen;
float fRed;
float Factor;

int iR;
int iG;
int iB;

//Our eyes can generally see light wavelengths between 350 and 700 nanometers.
//Here, we start the RGB Led with 350
int i = 350;

//RGB is plugged into these arduino digital pins
const int redOutPin = 8;
const int greenOutPin = 6;
const int blueOutPin = 4;

// LED to be tested is plugged into A0
int testPin = A0;    

// variables to store the value coming from the sensor
int sensorValueTest =0;  
int oldTest =0;
int peaknm =0;

//EEPROM start data
int addr=0;

//Music
int notelen = 90;
int dlx = 130;

void setup()
{
  pinMode(LCDOut, OUTPUT);
  pinMode(LCDIn, INPUT);

//Set the RGB LED pins to output

  pinMode(redOutPin, OUTPUT);
  pinMode(greenOutPin, OUTPUT);
  pinMode(blueOutPin, OUTPUT);


// Initialize the LCD display
  mySerialPort.begin(9600);
  mySerialPort.write(0xFE);
  mySerialPort.write(0x01);

  // test to see if the RGB LED works
  makeColor(i);
  analogWrite(redOutPin,255-iR);
  analogWrite(greenOutPin, 255-iG);
  analogWrite(blueOutPin, 255-iB);
  delay(5000);
}

void loop()
{

// set the RGB LED to a specific color
  makeColor(i);
  analogWrite(redOutPin, 255-iR);
  analogWrite(greenOutPin, 255-iG);
  analogWrite(blueOutPin, 255-iB);
  delay(500);
  
// read the sensitivity of the Test LED
  sensorValueTest= analogRead(testPin);

  if (sensorValueTest > oldTest)
  {
    oldTest = sensorValueTest;
    peaknm = i;
  }

// Display the values on the LCD
  sprintf(databuff,"CV:%3d Cnm:%3d",sensorValueTest,i);  
  sprintf(dispbuff,"%-16s",databuff);
  mySerialPort.print(dispbuff);

  sprintf(databuff,"XV:%3d Xnm:%3d",oldTest, peaknm);
  sprintf(dispbuff,"%-16s",databuff);
  mySerialPort.print(dispbuff);



  writeData();
  i++;

  // If we've reached the upper limit of 700 nm, play a little melody  
  if (i>700)
  {
    for (int f = 0; f<=100; f++)
    {
      tone(7,196,notelen);
      delay(dlx);

      tone(7,131,notelen);
      delay(dlx);

      tone(7,261,notelen);
      delay(dlx);

      tone(7,330,notelen);
      delay(dlx);

      tone(7,294,notelen);
    }
    delay(10000);
  }
}



void writeData()
{
  int quotient = i/256;
  int mod = i % 256;

  EEPROM.write(addr++,quotient);
  EEPROM.write(addr++,mod);

  quotient = sensorValueTest/256;
  mod = sensorValueTest % 256;
  EEPROM.write(addr++,quotient);
  EEPROM.write(addr++,mod);
}



void makeColor(int lambda)
{
  if (lambda >= 350 && lambda <= 439)
  {
    fRed    = -(lambda - (float)440.0) / ((float)440.0 - (float)350.0);
    fGreen = (float)0.0;
    fBlue = (float)1.0;
  }
  else if (lambda >= (float)440.0 && lambda <= (float)489.0)
  {
    fRed = 0.0;
    fGreen = (lambda - (float)440.0) / ((float)490.0 - (float)440.0);
    fBlue = 1.0;
  }
  else if (lambda >= (float)490.0 && lambda <= (float)509.0)
  {
    fRed = 0.0;
    fGreen = 1.0;
    fBlue = -(lambda - (float)510.0) / ((float)510.0 - (float)490.0);

  }
  else if (lambda >= (float)510.0 && lambda <= (float)579.0)
  {
    fRed = (lambda - (float)510.0) / ((float)580.0 - (float)510.0);
    fGreen = 1.0;
    fBlue = 0.0;
  }
  else if (lambda >= (float)580.0 && lambda <= (float)644.0)
  {
    fRed = 1.0;
    fGreen = -(lambda - (float)645.0) / ((float)645.0 - (float)580.0);
    fBlue = 0.0;
  }
  else if (lambda >= 645.0 && lambda <= 780.0)
  {
    fRed = 1.0;
    fGreen = 0.0;
    fBlue = 0.0;
  }
  else
  {
    fRed = 0.0;
    fGreen = 0.0;
    fBlue = 0.0;
  }

  if (lambda >= 350 && lambda <= 419)
  {
    Factor = 0.3 + 0.7*(lambda - (float)350.0) / ((float)420.0 - (float)350.0);
  }
  else if (lambda >= 420 && lambda <= 700)
  {
    Factor = 1.0;
  }
  else if (lambda >= 701 && lambda <= 780)
  {
    Factor = 0.3 + 0.7*((float)780.0 - lambda) / ((float)780.0 - (float)700.0);
  }
  else
  {
    Factor = 0.0;
  }
  iR = factorAdjust(fRed, Factor, MaxIntensity, Gamma);
  iG = factorAdjust(fGreen, Factor, MaxIntensity, Gamma);
  iB = factorAdjust(fBlue, Factor, MaxIntensity, Gamma);
}

int factorAdjust(float C, float Factor, int MaxIntensity, float Gamma)
{
  if(C == 0.0)
  {
    return 0;
  }
  else
  {
    return (int) round(MaxIntensity * pow(C * Factor, Gamma));
  }
}
72  Using Arduino / LEDs and Multiplexing / Re: Colorduino HELP on: February 14, 2013, 10:48:59 am
You may want to post about this in the programming forum - there are people there that have a lot of experience with the not in sync issue.
73  Using Arduino / LEDs and Multiplexing / Re: Help with Colorduino on: February 13, 2013, 03:17:59 pm
I would first plug it in and look at the output of "dmesg". You should see recent activity indicating Linux found the USB device and has created a device such as /dev/ttyUSB0 or some such entry. If you don't see this - this is your first hit at a problem. If you do see it, you might try a common program like kermit and add a loop back to the far end of the cable. Then, simply type something. You should see it echo back as if you were typing into an editor. If all that works and the Arduino SDK still doesn't - I would next suspect that the Arduino SDK is trying to create lock files to prevent other programs from using the /dev/ttyUSB0 device (or what ever it was called) but failed. At this point, I (briefly) ran the Arduino SDK as root as a test.
74  Using Arduino / LEDs and Multiplexing / Re: 4x4x4 RGB Cube schematic on: February 13, 2013, 12:23:15 am
Those are for the standalone Arduino that is controlling the cube.  Instructions for the standalone Arduino start at step 16, then follow the diagram and instructions in step 17 to place the crystal and it's capacitors.

The schematic references using a pre-built Arduino, but the parts list and instructions use a standalone Arduino, so I can understand the confusion.
75  Using Arduino / General Electronics / Re: common cathode/common anode confusion on: February 13, 2013, 12:09:39 am
The other three pins would connect to the pins that you are using to control them, such as pins 2,3,4.  For instance you might connect the red cathode to pin 2, green cathode to pin 3, and the blue cathode to pin 4.  You would then use analogWrite to send PWM values to those pins to control the intensity of the colors.
Pages: 1 ... 3 4 [5] 6 7 ... 21