Description
hi,
i am trying to send 6 data(uart mode 9600) to bolt cloud using arduino and bolt module. Arduino is getting 6 data in array in spi slave and transferring them to cloud. problem is , all data getting uploaded except first and sixth.
the code will upload all data properly, if i don’t use spi.
Please suggest , is there any problem with arduino code or any bug with bolt cloud
#include <SPI.h>
#include <BoltIoT-Arduino-Helper.h>
int b[6],i=0;
bool cloudMode=true;
void setup (void)
{
boltiot.begin(Serial);
Serial.begin (9600);
SPCR |= bit(SPE); /* Enable SPI /
pinMode(MISO, OUTPUT); / Make MISO pin as OUTPUT */
SPI.attachInterrupt(); /* Attach SPI interrupt */
}
void loop (void)
{
cloudMode=boltiot.processPushDataCommand(b[0],b[1],b[2],b[3],b[4],b[5]);
if (cloudMode){
SPI.attachInterrupt();
}
}
// SPI interrupt routine
ISR (SPI_STC_vect)
{
cli();
byte c = SPDR;
b[i]=c;
i++;
Serial.println(c);
if (i==6){
i=0; cloudMode=false;
SPI.detachInterrupt();
}
}
In downloaded excel sheet the first parameter copies data from second parameter and last 5 parameter is correct.
where as on browser first and sixth parameter is not plotting.
please suggest, where i am making mistakes.
Thanks in advance