Hello, im new to IMP microcontrollers platform in general but
the thing is i have to build this project for my school, wich consists of max6675 spi based thermo couple sensor, and electricimp as microcontroller. The main task is to read sensor value, and then based on
the readings turn an led , for example. I found pretty good instruction in imps user guides about SPI’s, and how to work with them using imp. But things are not workig well for me.
Code:
/// Config
spi <- hardware.spi257;
spi.configure(SIMPLEX_RX| MSB_FIRST |CLOCK_IDLE_LOW|CLOCK_2ND_EDGE,400);
local cs = hardware.pin1; // selecting pin for chipselect
cs.configure(DIGITAL_OUT,1);
function read8bytes() {
cs.write(0); // set cs LOW to start reading values
// Read some data...
local s = spi.readblob(8);
cs.write(1); // set cs HIGH to stop reading values
return s;
}
server.log(read8bytes().tostring());
read8bytes();
The values are -
02 e0 02 e0 02 e0 02 e0
MAX6675 holds its values in 12 bits, where FFF is 1023 degrees.
So how do i can convert those values in degrees? and check if they are accurate ?
Thanks!