Show Posts
|
|
Pages: [1] 2 3 4
|
|
5
|
Forum 2005-2010 (read only) / Syntax & Programs / Re: Syntax - how to read which pins are HIGH
|
on: August 06, 2008, 05:33:08 pm
|
Why do you need an array with all the combinations? You can tell which pins are high by looking at which bits of your byte are set (i.e. are 1).
if (_data & 1) // P0 is set
That is what I was looking for. I do not know C and that's why I could not do that. Tell me please how should I understand that: (_data & 1) // OK I already know.... And now, other way. I have 8 variables: p1 = 1; p2 = 1; p3 = 0; p4 = 0; . . How to tell PCF8574 taht these pins (1,2,3,4) should be like 1,1,0,0....? Thanks!
|
|
|
|
|
6
|
Forum 2005-2010 (read only) / Syntax & Programs / Syntax - how to read which pins are HIGH
|
on: August 06, 2008, 04:18:39 pm
|
Hi, I am reading the state of PCF8574 pins like this: byte expanderRead() { byte _data; Wire.requestFrom(expander, 1); if(Wire.available()) { _data = Wire.receive(); } return _data; }
When: P0 is HIGH I get 1 P1 is HIGH I get 2 P2 is HIGH I get 4 P3 is HIGH I get 8 . . . P1 and P2 are HIGH I get 3 When only one pin is HIGH there is no problem - only 8 combinations. When more pins are HIGH there is a problem - 256 combinations. I need to create an array with all combinations! Is there a simple method to read which pins are HIGH? Thanks for help!
|
|
|
|
|
7
|
Forum 2005-2010 (read only) / Syntax & Programs / Re: I2C Synthax - beginner
|
on: July 13, 2008, 01:52:36 pm
|
On the page you linked Register 6 is the configuration for 8 I/O pins, register 7 for the 8 olthers pins. So, you are sending the number 6 to the chip to tell it that you want to access the register number 6 (REGISTER_CONFIG = 6).
Now I understand... but have one more question.. I've found a datasheet: http://www.datasheetcatalog.org/datasheet/philips/PCA9555_3.pdf"... This register is an input-only port. It reflects the incoming logic levels of the pins,..." (site 6) if I understand I can not set all 16 pins as output or input? Is there a I/O I2C chip where I can set all 16 pins how I want? Thanks for help!
|
|
|
|
|
8
|
Forum 2005-2010 (read only) / Syntax & Programs / I2C Synthax - beginner
|
on: July 12, 2008, 06:52:40 pm
|
Hi, I've found a great tutorial on: http://www.neufeld.newton.ks.us/electronics/?p=241but I have some questions: (my questions as comments) #define DIP_ADDRESS (0x4 << 3 | 0x0) // how should I understand that << and | Wire.send(0xff & dir); // the same question with & Wire.send(dir >> 8); // the same question with >> //What make that three lines?
and one more question here: #define REGISTER_CONFIG (6) // has REGISTER_CONFIG a value 6? Wire.send(REGISTER_CONFIG); // why am I sending 6?
Thanks for Your help!
|
|
|
|
|
13
|
Forum 2005-2010 (read only) / Interfacing / LCD display via I2C - Help me!
|
on: July 09, 2008, 12:34:53 pm
|
|
Hi,
I am new with Arduino and electronic too. I want to connect to my Arduino an alphanumeric LCD display via I2C Bus.
Do you have any schema (circuit) how should I connect it, which controller (driver) should I use. I was thinking about PCF7584 but I do not know...
So if you could help me... Some examples of code, how to send words to lcd would be great too.
Thanks for your help!
|
|
|
|
|
14
|
Forum 2005-2010 (read only) / Frequently-Asked Questions / PHP - Arduino communication - the best way?
|
on: June 26, 2010, 05:28:53 pm
|
|
HI,
i've tried to communicate between arduino and php. I used the php_serial class and it works great (linux server) with a simple instructions.
My goal is to control two or more output pins and read the input pins using php. And now how i want to do this:
I send a string to arduino:'1;0;0;1' to set pin1:HIGH, pin2:LOW, pin3LOW, pin4:HIGH. As response send arduino to php a string '1;1;0' what means pin5 is HIGH, pin6 is HIGH and pin7 is LOW.
Do you think it is a good idea? In php i will use the explode function to get an array from the string. In Arduino i have to do the same, but c has no explode function, do you have any idea how to do this?
Thanks for help!
|
|
|
|
|