Is this possible?
Can i do both simultaneously?
I know thath for I2C communication i have to use the pins 4 and 5 of the analog input,
You can do nothing simultaneously on a single processor, you do them sequentially very fast so it looks like simultaneously.
It is not those pins on a mega it is pins 20 & 21
2) The Lego uses a 3v3 I2C bus and the sensors might need a 5V bus so you will need some hardware bus level shifters.
One trick my be to poll your slave just after the mind storm polls you.
ally you can use this snag to your advantage. Since you'll need a level shifter use an IC like a TXS0102 that has an output enable pin. Once the mindstorm is done communicating with the Arduino, drive the output enable LOW and force the bus between the mindstorm and Arduino into a Hi-Z state. If the mindstorm tries to poll the Arduino it won't get a response and will leave you free to communicate with the rest of the sensors. Just make sure the sensors are all wired downstream of the level shifter. Also if the sensors can handle Fast Mode (400kHz) bump up the I2C speed when communicating with them, that should minimize timing concerns.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16