Author Topic: SimbleeRNG  (Read 202 times)

jaltet

  • RFduino Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
SimbleeRNG
« on: April 18, 2017, 12:12:46 PM »

Hello everybody!

I am trying to have the Simblee generate a random number using SImbleeRNG. here is my code:
Code: [Select]
void Generate_Ticket_Number()
{
 uint8_t stream[8];
 uint8_t N_Ticket[12];
 SimbleeRNG::generate(stream, sizeof(stream));
 
for (int i=0; i<4; i++)
{
N_Ticket[3*i]   = stream[i]/100;
N_Ticket[3*i+1] = (stream[i]-100*N_Ticket[3*i])/10;
N_Ticket[3*i+2] = stream[i]-100*N_Ticket[3*i]-10*N_Ticket[3*i+1];
}
for (int i=0; i<13;i++)
{
  Serial.print(char(N_Ticket[i]));
}
for (int i=0;i<10;i++)
{
  Ticket[i]= char(N_Ticket[i]+0x30);
}
Serial.println("");
Serial.println(Ticket);
}

This works and I can generate a random number that will be used to print a Ticket. However, if I call this routine in an event related to the User Interface (hitting a button on my iPhone), Simblee looses communication and the software hangs up.
Does this mean that SimbleeRNG() cannot be used within the processing of an event?
Thank you for your attention

tolson

  • Global Moderator
  • *****
  • Posts: 838
  • Karma: +19/-0
    • View Profile
    • Thomas Olson Consulting
Re: SimbleeRNG
« Reply #1 on: April 18, 2017, 03:48:27 PM »
It would be better if you provide complete code ready to install. Then one can see what you have going on.

Are you using with Simblee For Mobile?

 

anything