Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: C12832 MMA7660 MQTT
Fork of HelloMQTT by
genRandom
genRandom dient ausschließlich im Klassenraum bzw. am Brocker, um unterschiedliche Client-IDs in der Startphase zu haben:
static const char alphanum[] =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int stringLength = sizeof(alphanum) - 1;
// use for random
#include "MMA7660.h"
MMA7660 MMA(p28, p27);
char genRandom()
{
if (MMA.testConnection())
logMessage("get seed: Please shake the board for 1s \r\n");
int x;
for (int i=0; i < 5; i++) {
x=(int) (MMA.z() * MMA.z() * MMA.z()*100)% 65;
//logMessage("seed: %d\r\n", x);
wait_ms(200);
}
srand (x);
return alphanum[rand() % stringLength];
}
