Pages: [1]   Go Down
Author Topic: Connect arduino to mpr083 (freescale touch sensor)  (Read 695 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good afternoon.
I'm doing a projects which consists in do a touch sensor.
So i decided use the freescale touch sensor MPR083.
However I have many problems in use the wire library.
What happens is that the arduino crashes when it goes execute de code: Wire.endTransmisson.

The code that I do is:

Quote
#include <Wire.h>

void setup()
{
  Serial.begin(9600);
  Wire.begin(); // join i2c bus (address optional for master)

}


void loop()
{
  Serial.println("vai escrever");
  Wire.beginTransmission(0b10011010); // transmit to device #4
  Wire.send(0b00001010);        // sends five bytes
  Wire.send(0b00010101);              // sends one byte  
  Wire.endTransmission();    // stop transmitting
  delay(500);
  Serial.println("escreveu");
}


Anyone can help me to do this project?
TKS
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i have the same problem :S
Logged

Norway
Offline Offline
Sr. Member
****
Karma: 0
Posts: 344
Just dip it in mercury and power it up
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you tried sending the numbers in hex?

Quote
Wire.send(0b00001010);        // sends five bytes

Why would sending the number 10 send five bites?
and 21 for sending one byte?

What does the datasheet say?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yeah, I forgot delete the comments. It was copy paste of an example code.
The datasheet doesn't have nothing about the code.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How you can see here:


it's 1001101 for adress and 0 or 1 to read or write.
Code:
Wire.beginTransmission(0b10011010);

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok i understand that but isn't it what i put?
Look:  Wire.beginTransmission(0b10011010) , the firsts seven bits are the adress and th last is the instruction to write.  Am I correct?  
Logged

Pages: [1]   Go Up
Jump to: