diff options
author | siddhu8990 | 2017-06-20 15:34:06 +0530 |
---|---|---|
committer | siddhu8990 | 2017-06-20 15:34:06 +0530 |
commit | e92d6c6791aae06053637ad3bf6b0f9d8986986c (patch) | |
tree | 9326f0bed06ee4ce9e2bf54d03ee3fde10ef5ea9 /src/c/scilab-arduino/cmd_i2c_read | |
parent | fad32de9c3df04a8fb032f9c604c79c89d062154 (diff) | |
parent | 369c257b9ae0320621b43ca75b38ff66cc13f37b (diff) | |
download | scilab2c-e92d6c6791aae06053637ad3bf6b0f9d8986986c.tar.gz scilab2c-e92d6c6791aae06053637ad3bf6b0f9d8986986c.tar.bz2 scilab2c-e92d6c6791aae06053637ad3bf6b0f9d8986986c.zip |
Merged with Yash's work. Gui modified for Arduino board selection. Arduino I2C functions added
Diffstat (limited to 'src/c/scilab-arduino/cmd_i2c_read')
-rw-r--r-- | src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp b/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp new file mode 100644 index 00000000..8f02a87e --- /dev/null +++ b/src/c/scilab-arduino/cmd_i2c_read/u8cmd_i2c_reads.cpp @@ -0,0 +1,18 @@ +#include "cmd_i2c_read.h" +#include "Arduino.h" +#include "Wire.h" + +float u8cmd_i2c_reads(uint8 address, uint8 bytes) +{ + + float c; //variable declaration to save received data + + // request reading from sensor + Wire.requestFrom(address, bytes); // request no. of bytes(given) from slave device with address + + // receive reading from sensor + while (Wire.available()) //If data is received + c = Wire.read(); //Save received data in variable + return(c); + +} |