Loading...
  Show Posts
Pages: 1 2 3 [4] 5 6 ... 9
46  Using Arduino / Networking, Protocols, and Devices / i2c attiny85 non responsive on: March 22, 2013, 09:45:29 am
hello all, im not getting any response from this, im thinking the pcf itself might not be compatible since data sheet says compatible with most mcu's. have gotten other code to work on attiny including blink and some home brew stuff. this is just a test to lead to better stuff, and ive tried 2 different ic's and 2 different attiny's. datasheet here http://www.ti.com/lit/ds/symlink/pcf8574.pdf      also, instead of '0' (all on) ive sent different data, ie 254h which is some on some off.

Code:
#include <TinyWireM.h>


// address of PCF8574 IC on TWI bus
#define IO_ADDR 0x20
byte data = 0;
byte alloff = 0xFF;
void setup() {
  TinyWireM.begin();        // initialize the I2C/TWI interface
  TinyWireM.beginTransmission(IO_ADDR);
  TinyWireM.send(alloff);
  TinyWireM.endTransmission();
  delay(10);
  TinyWireM.beginTransmission(IO_ADDR);
  TinyWireM.send(data);
  TinyWireM.endTransmission();
}
void loop() {}
47  Using Arduino / Project Guidance / Re: Dumb Dad needs homework help!!!!!!! on: March 20, 2013, 08:31:17 pm
can use a for loop for the soundmaker
48  Using Arduino / Project Guidance / Re: Need ideas for additional features to my smart home project. on: March 20, 2013, 08:28:20 pm
humidity readings? also maybe volt/current load readings for each room? i was a facilities manager for a few years, we monitored load conditions and voltage, of course this was industrial so we had more than one phase. just a thought.
49  Using Arduino / Project Guidance / Re: Button Help - Trying to make LED go off when button is not pushed on: March 20, 2013, 08:24:42 pm
Code:
val = digitalRead(12);   // read the input pin
 digitalWrite(13, val);

maybe something like this?
50  Using Arduino / Project Guidance / Re: running bitlash scripts from the arduino on the arduino without serial input on: March 20, 2013, 08:21:43 pm
very nice project!  smiley
51  Using Arduino / Programming Questions / Re: interrupts with conditions on: March 20, 2013, 07:58:01 pm
Code:
#include <avr/interrupt.h>
volatile int doorlock;

void setup(){
pinMode(2,INPUT);
digitalWrite(2,HIGH);
attachInterrupt(0, doordoingsomething, FALLING);  // or attachInterrupt(0, doordoingsomething, RISING); or attachInterrupt(0, doordoingsomething, CHANGE);
doorlock = 0
// other setup
interrupts();  // starts the int's
}
void loop(){
if (doorlock == 1){  // if this = 1 then int has fired
alarmneedstohappen();
}
// normal loop stuff
}

void doordoingsomething();
doorlock=1; // sets flag to 1 so loop if catches it
}

void alarmneedstohappen();{
// we are here because int flag happened.
doorlock = 0 // reset int flag
// perform other alarm stuff of whatever
}
52  Using Arduino / Programming Questions / Re: I2C Arduino Uno Problem on: March 20, 2013, 07:43:18 pm
Wire.endTransmission(); should return a zero on success.

some very good information is here http://www.gammon.com.au/forum/?id=10896, should get you going and answer all your questions. it helped me alot.
53  Using Arduino / Programming Questions / Re: I2C Arduino Uno Problem on: March 20, 2013, 02:15:12 pm
Quote
you usually send 0x00 first to the device to tell it to get ready.

not all devices needs this, best to check the datasheet for your specific device(s).  smiley-grin
54  Using Arduino / Programming Questions / Re: I2C Arduino Uno Problem on: March 20, 2013, 01:31:55 pm
not sure if needed/helpful but

Code:
Wire.endTransmission();
55  Using Arduino / Programming Questions / Re: Learning Interrupts arduino Uno on: March 19, 2013, 08:29:35 pm
http://arduino.cc/en/Reference/AttachInterrupt

helped me understand it a bit better
56  Using Arduino / Sensors / unnofficial guide to PCF8574 i/o expansion i2c bus on: March 18, 2013, 11:13:34 am
greetings, i posted this to bring together all the tidbits on this device, of which i've become interested in. theres alot of scattered info all over. please, smart people correct/add to this. this device will add 8 inputs or outputs. datasheet here http://www.ti.com/lit/ds/symlink/pcf8574.pdf

older library here, i couldnt get this to work but someone maybe able to update it http://arduino.cc/forum/index.php?topic=109340.0
playground stuff http://playground.arduino.cc/Main/I2CPortExpanderAndKeypads
tutorial to get you up and running http://tronixstuff.wordpress.com/2010/10/29/tutorial-arduino-and-the-i2c-bus-part-two/
to understand i2c please see Mr. Gammon's tutorial here http://www.gammon.com.au/forum/?id=10896
they call it knightrider, i call it cylon http://startingelectronics.com/beginners/start-electronics-now/tut18-two-wire-arduino-knight-rider/
reading as inputs, have a care though, its not Wire.receive anymore its Wire.read http://practicalmaker.com/blog/arduino-reading-pcf8574-pins-inputs
this code works for reading inputs, but i believe the schematic is wrong http://garagelab.com/profiles/blogs/tutorial-arduino-i-o-port-expander-with-pcf8574

be nice to have a library for this, something im going to tinker with, but alas, i am not, dare i say, up to the task "yet". but please if someone skilled is bored and has time on their hands. just remember to control the outputs, 0= all on, 0x255= all off, 0x254= port0 on (11111110), although, i get erratic behavior if i send BIN instead of HEX. as far as addressing goes, the datasheet answers this, image attached, eg pins A0-A2 grounded = address 0x20.


thank you for your time. more will be added as i learn/find it.  edit-added my i2c test shield.

reading an input as a test..
Code:
#include<Wire.h>

byte x=0;


void setup()
{
    Wire.begin();
    Serial.begin(9600);
}

void loop()
{
    Wire.requestFrom(0x21,1);
    if(Wire.available())     //If the request is available
    {
        x=Wire.read();       //Receive the data
    }
    Serial.println(x);
    delay(10000);
}

//inputs shorted to ground
if port0 is on and all off x will equal 254.

** maybe a better option is the MCP23017. Nick Gammon has extensive documentation here http://www.gammon.com.au/forum/?id=10896 and adafruit has libraries already in place. i ordered a few of these the other day. happy port expanding!
57  Using Arduino / Networking, Protocols, and Devices / Re: Communicate With Arduino Wirelessly - Best Options? on: March 16, 2013, 04:14:23 pm
http://www.sparkfun.com/pages/xbee_guide
58  Using Arduino / Programming Questions / Re: Switching on Serial Monitor from code? on: March 16, 2013, 03:47:33 pm
gobetwino, not the answer your looking for exactly but maybe worth a look http://mikmo.dk/gobetwino.html
59  Using Arduino / Networking, Protocols, and Devices / Remote 8-bit I/O Expander for I2C Bus on: March 15, 2013, 06:00:19 pm
sorry, strike this. found this http://tronixstuff.wordpress.com/2010/10/29/tutorial-arduino-and-the-i2c-bus-part-two/ covers the whole chip lol. good day all.


http://www.ti.com/lit/ds/symlink/pcf8574.pdf

Would someone be kind enough to take a gander and let me know if this is a good fit with the UNO, as i have a few laying around, or if using these im in for a bumpy road. id like to use this on the bus with an 24lc256.
specifically,

Quote
After the start condition, the device address byte is sent,
most-significant bit (MSB) first, including the data direction bit (R/W). This device does not respond to the general
call address. After receiving the valid address byte, this device responds with an acknowledge, a low on the SDA
I/O during the high of the acknowledge-related clock pulse. The address inputs (A0–A2) of the slave device must
not be changed between the start and the stop conditions.
The data byte follows the address acknowledge. If the R/W bit is high, the data from this device are the values
read from the P port. If the R/W bit is low, the data are from the master, to be output to the P port. The data byte
is followed by an acknowledge sent from this device. If other data bytes are sent from the master, following the
acknowledge, they are ignored by this device. Data are output only if complete bytes are received and
acknowledged. The output data will be valid at time, t
pv, after the low-to-high transition of SCL and during the
clock cycle for the acknowledge.
A stop condition, which is a low-to-high transition on the SDA I/O while the SCL input is high, is sent by the
master.
60  General Category / General Discussion / Re: you assume quite a lot on: March 15, 2013, 04:03:09 pm
 
Quote
people like you are the reason why more people are not interested in learning anything.

personally, theres a few guys on here id love to sit down with for a few hours to learn some stuff from, but alas, i dont have that much money for beer. i could fly you all in, but not beer, too expensive.  smiley-eek-blue

now if i really wanted to know something bad, and quick,  like example, how to push a button and make an led blink, i would offer someone money or something to write me some code. paypal.

i am impressed how much knowledge is floating <<< no pun intended, around here. i would like to thank those that do take time out of their day to help out.
Pages: 1 2 3 [4] 5 6 ... 9