Show Posts
|
|
Pages: [1]
|
|
1
|
Using Arduino / Networking, Protocols, and Devices / Re: Mistery: I2C not working, blink working
|
on: December 01, 2012, 12:29:04 pm
|
As I understand I2C is digital protocol, but why we can use ony 2 pins for it? Because the AVR chip uses special internal hardware to support the I2C function and it only wires that function to those two specific pins. Just like the hardware serial function on a standard Uno is only available on pins 0 and 1, same thing going on there. analogWrite (pwm outputs) only works on specific pins because it uses internal chip hardware timers that only wire up to specific pins. All I/O pins can be used as simple digital input or output pins, but most of the special functions of the chip are only supported by specific pins. The AVR datasheet is the best source of information on this topic. Lefty Can this special internal hardware be damaged?
|
|
|
|
|
3
|
Using Arduino / Networking, Protocols, and Devices / Re: Mistery: I2C not working, blink working
|
on: November 30, 2012, 12:41:09 pm
|
Hello again. I bought oscilloscope today and tried to measure what's going on. Same programm on arduino uno and arduino mega. Right connection to both. This is oscillogramm from uno(it's good):  On mega no impulses appear. I also made an experiment. I wrote this code to mega and use oscilloscpe with it: void setup() { // nothing happens in setup }
void loop() { while(true){ analogWrite(21, 0); delay(1000); analogWrite(21, 100); delay(1000); analogWrite(21, 255); delay(1000); } }
But i saw only one impulse at 5V with 1sec duration and then 2sec 0V. My theory is that DAC is broken, but I still don't know why I 2C isn't working. Anyway powering from battery doesn't give any results.
|
|
|
|
|
7
|
Using Arduino / Networking, Protocols, and Devices / Re: Mistery: I2C not working, blink working
|
on: November 18, 2012, 06:19:58 am
|
As requested: Uno connection:  Mega connection:  Main code: #include <Wire.h> #include <L3G.h>
L3G gyro;
void setup() { Serial.begin(9600); Wire.begin(); if (!gyro.init()) { Serial.println("Failed to autodetect gyro type!"); while (1); }
gyro.enableDefault(); }
void loop() { gyro.read();
Serial.print("G "); Serial.print("X: "); Serial.print((int)gyro.g.x); Serial.print(" Y: "); Serial.print((int)gyro.g.y); Serial.print(" Z: "); Serial.println((int)gyro.g.z);
delay(100); }
Library: https://github.com/pololu/L3G
|
|
|
|
|
10
|
Using Arduino / Networking, Protocols, and Devices / Re: Mistery: I2C not working, blink working
|
on: November 16, 2012, 04:33:06 pm
|
Ok, code is from examples for L3G, it works on uno, but don't work on mega. Don't think it need to be checked. Addresses are default, that proved by uno run. Using this imu: http://www.pololu.com/catalog/product/1265I don't use any resistors. Tried to use 3.3V and 5V, imu board uses vin voltage for I2C voltage.
|
|
|
|
|
13
|
Forum 2005-2010 (read only) / Interfacing / IR distanse sensor connect and communicate
|
on: November 12, 2010, 11:41:16 am
|
|
Hi there, I'm new at electronics and new in arduino code. I bought IR distance sensor HLC1395. I don't know how connect it to my arduino Duemilanove. I guess I need some resistors between sensor and platform, but I don't know how many Ohm do i need. I also need code or advise how get distanse form it. I guess i must count milliseconds between LED blink and transistor response and divide it on light speed, am i right?
Please help me
|
|
|
|
|