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. #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() {}
|
|
|
|
|
51
|
Using Arduino / Programming Questions / Re: interrupts with conditions
|
on: March 20, 2013, 07:58:01 pm
|
#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 }
|
|
|
|
|
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.pdfolder library here, i couldnt get this to work but someone maybe able to update it http://arduino.cc/forum/index.php?topic=109340.0playground stuff http://playground.arduino.cc/Main/I2CPortExpanderAndKeypadstutorial 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=10896they 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-inputsthis code works for reading inputs, but i believe the schematic is wrong http://garagelab.com/profiles/blogs/tutorial-arduino-i-o-port-expander-with-pcf8574be 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.. #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!
|
|
|
|
|
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.pdfWould 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, 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
|
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.  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.
|
|
|
|
|