47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
#include <bcconfig.h>
|
|
#include <BigNumber.h>
|
|
#include <number.h>
|
|
|
|
#define numberOfSensors 50
|
|
int flexSensorPins[] = {A0, A1, A2, A3};
|
|
|
|
int mapValue;
|
|
String reference[] = {"L","H","R"};
|
|
String finalReadable;
|
|
String final;
|
|
int i = 0;
|
|
|
|
void setup() {
|
|
Serial.begin(9600);
|
|
BigNumber::begin();
|
|
}
|
|
|
|
String compression(int values[]) {
|
|
String combinedInt = "";
|
|
String header = "";
|
|
for (i = 0; i < numberOfSensors; i++) {
|
|
if(values[i] < 10) {
|
|
if(values[i] < 0) {
|
|
header += String(i) + ",";
|
|
combinedInt += String(values[i] * -1);
|
|
} else {
|
|
combinedInt += "0" + String(values[i]);
|
|
}
|
|
} else {
|
|
combinedInt += String(values[i]);
|
|
}
|
|
}
|
|
return header.substring(0,header.length()-1) + "." + combinedInt;
|
|
}
|
|
|
|
void loop() {
|
|
finalReadable = "";
|
|
final = "";
|
|
int dataValues[] = {32, 62, 10, 7, -45, 91, -95, 27, 54, 50, 67, 84, 92,
|
|
68, 10, 53, 79, 65, 06, 62, 60, -15, 52, 63, 71, 9,
|
|
52, -86, 68, 52, 96, 30, 31, 50, 24, 56, -61, 54, 40, 26,
|
|
33, 34, 32, 28, 2, 96, 3, 77, 66, 97};
|
|
Serial.println(compression(dataValues));
|
|
delay(250);
|
|
}
|