Show Posts
Pages: 1 2 [3] 4
31  Using Arduino / Programming Questions / Re: PCF8574AN configured as output for relay on: February 16, 2013, 11:03:08 am
like this ?
Code:
}
  int Stereovalue = analogRead(A2);                 // Read the Stereo input on Analog pin 2:
  float Stereo = Stereovalue * (4.5 / 1023.0);      // Convert the Stereo value to a voltage

  if (Stereo<1)                                     // A Stereo signal wil be present Lower then 1 volts!(0,8v) Mono = 3,6v
{
 void setOutptr(byte bitToChange)
{
    Wire.beginTransmission(PCF2_output);
    outputData |= 1;
    Wire.write(outputData);                         // set the bit and leave the others alone
    Wire.endTransmission();

    digitalWrite(Stereoled, HIGH);                  // Turn Stereo LED "ON" when Tuner receive a Stereo signal
    lcd.setCursor(21,0);
    lcd.print("S");                                 // display Stereo signal received
}
  else
{
 void clearOutptr(byte bitToChange)
 {
    Wire.beginTransmission(PCF2_output);
    outputData &= ~(1);
    Wire.write(outputData);                         //  clear the bit and leave the others alone
    Wire.endTransmission();

    digitalWrite(Stereoled, LOW);                   // Turn Stereo LED "OFF" when there is no Stereo signal
    lcd.setCursor(21,0);
    lcd.print("M");                                 // display Mono signal received
}
32  Using Arduino / Programming Questions / Re: PCF8574AN configured as output for relay on: February 15, 2013, 05:42:23 pm
ok, great.

i will test tomorrow.

let u know!.

thanks for the help so far smiley

edwin
33  Using Arduino / Programming Questions / Re: PCF8574AN configured as output for relay on: February 15, 2013, 04:30:33 pm
this is a part of the code.

Code:
 int Stereovalue = analogRead(A2);                 // Read the Stereo input on Analog pin 2:
  float Stereo = Stereovalue * (4.5 / 1023.0);      // Convert the Stereo value to a voltage

  if (Stereo<1)                                     // A Stereo signal wil be present Lower then 1 volts!(0,8v) Mono = 3,6v
{
    Wire.beginTransmission(PCF2_output);            // Begin the transmission to PCF8574AN
    Wire.write(Yellow);                             // (P2) Stereo led (Yellow)
    Wire.endTransmission();                         // End the Transmission

    digitalWrite(Stereoled, HIGH);                  // Turn Stereo LED "ON" when Tuner receive a Stereo signal
    lcd.setCursor(21,0);
    lcd.print("S");                                 // display Stereo signal received
}
  else
{
    Wire.beginTransmission(PCF2_output);            // Begin the transmission to PCF8574AN
    Wire.write(0, Yellow);                             // turn off LED (P2)
    Wire.endTransmission();                         // End the Transmission

    digitalWrite(Stereoled, LOW);                   // Turn Stereo LED "OFF" when there is no Stereo signal
    lcd.setCursor(21,0);
    lcd.print("M");

the Relay PCF2 is compare as the "digitalWrite(Stereoled, HIGH)" or "digitalWrite(Stereoled, LOW)"
This mean that in this code, when i dont have a Stereo signal the relay (LED for now) is switched off and stay off
and if there is a signal, it swiched on and stay on

for testing the code i have put a LED color Yellow in the PCF  
34  Using Arduino / Programming Questions / Re: PCF8574AN configured as output for relay on: February 15, 2013, 04:20:05 pm
maybe i have a idee,

my Project code is to big and to private to post it here.

maybe i can send it to u by email, where u can see inside the code where to put the relay on and off .

i think this will helpfull and to better understand for u, if u want help me with this


regards,
edwin
35  Using Arduino / Programming Questions / Re: PCF8574AN configured as output for relay on: February 15, 2013, 04:16:11 pm
thanks for the example, that works fine as i expected.

but the question are still here.

it must switch a relay ON or OFf and not flashing hihi.
just to test the code i have used a LED

36  Using Arduino / Programming Questions / Re: PCF8574AN configured as output for relay on: February 15, 2013, 04:00:06 pm
what i want to make is to have full control on each output port.

example:
i want to switch on some pin. this pin must stay on if the code say so.
in the mean time i want have some other pin switched on or off if it is asking in the code.

hope u understand, little poor english.

edwin
 
37  Using Arduino / Programming Questions / Re: PCF8574AN configured as output for relay on: February 15, 2013, 03:56:03 pm
it is like flashing loop light.
38  Using Arduino / Programming Questions / Re: PCF8574AN configured as output for relay on: February 15, 2013, 03:13:08 pm
anybody else a idee how to manage a PCF ?
39  Using Arduino / Programming Questions / Re: PCF8574AN configured as output for relay on: February 14, 2013, 06:05:58 pm
ok, thanks.

i ll wait any result.
40  Using Arduino / Programming Questions / Re: PCF8574AN configured as output for relay on: February 14, 2013, 05:28:07 pm
Quote
Have you got pull up resistors?
yes, offcourse.

Quote
Are you using the analogue pins 4 & 5 not the digital ones?
Im use on the arduino uno the pins located near the reset button, marked with SDA/SCL. so not use pin 3 and 4.

Quote
Have you got the anode of the LED connected to 5V, cathode to a resistor and resistor to the PCF output pin?
yes, i hope the attachment is here u can see the diagram i quickly made.

i have also tried some other LED's with same voltage and less mA. but same result.
41  Using Arduino / Programming Questions / Re: PCF8574AN configured as output for relay on: February 14, 2013, 04:31:56 pm
i am just test it now with some LED (20mA), and this is also not working!

dont worry the relay wiring, this is drived by some transistor, and or optocouplers ect ect,,,,

it is just the software what is not working fine.
42  Using Arduino / Programming Questions / PCF8574AN configured as output for relay on: February 14, 2013, 04:17:51 pm

i use the output P0/P1/P2 ect... to switch independent the output, a relay and must stay ON untill this is asking in some code to switch it OFF.

for the test i made this example, but it will not work good, it is like flashing loop light.



any software example help would be great.

Code:
/*
PCF adress = 0x38

configured as output to control the relay

*/

#define PCF2_output 0x38          // (Relay) PCF8574AN, Address 0x38 with A0-A1-A2 pins grounded.
#include <Wire.h>

void setup()
{
  Wire.begin();
  Serial.begin(9600);
}
void loop()
{
  Wire.beginTransmission(PCF2_output);
  Wire.write(254);                     // turn relay 1 on (P0)
  Wire.endTransmission();
  Serial.print("Relay 1: ");
  Serial.println(HEX);
  
delay(1500);

  Wire.beginTransmission(PCF2_output);
  Wire.write(253);                      // turn relay 2 on (P1)
  Wire.endTransmission();
  Serial.print("Relay 2: ");
  Serial.println(HEX);
  
  delay(1500);
  
  Wire.beginTransmission(PCF2_output);
  Wire.write(251);                      // turn relay 3 on (P2)
  Wire.endTransmission();
  Serial.print("Relay 3: ");
  Serial.println(HEX);
  
delay(1500);
}


43  Using Arduino / Programming Questions / Re: Fload value on: January 07, 2013, 05:49:05 pm
Code:
lcd.print(AFC,4);

this is what I'm looking for.

shame myself, i must know this.

thanks smiley
44  Using Arduino / Programming Questions / Re: Fload value on: January 07, 2013, 04:30:12 pm
Adafruit carries a couple of nice I2C ADC modules that will give much higher resolution results then the internal ADC does:
https://www.adafruit.com/products/1083
http://www.adafruit.com/products/1085

ah, this is great.

thanks
45  Using Arduino / Programming Questions / Re: Fload value on: January 07, 2013, 04:18:44 pm
You need better hardware to get more precession from an A/D converter.

thx smiley-sad
Pages: 1 2 [3] 4