HAHA! commit
Initial commit
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
#define SENSOR_PIN ANALOG1
|
||||
|
||||
int delay_reading = 500;
|
||||
int reading = 0;
|
||||
char reading_buff[20];
|
||||
|
||||
// define folder and file to store data
|
||||
char* logfile="log.csv";
|
||||
|
||||
|
||||
void setup() {
|
||||
|
||||
USB.ON();
|
||||
|
||||
SD.ON();
|
||||
//SD.mkdir(path);
|
||||
|
||||
// delete file
|
||||
if(SD.del(logfile)) {
|
||||
USB.println(F("file deleted"));
|
||||
} else {
|
||||
USB.println(F("file NOT deleted"));
|
||||
}
|
||||
|
||||
// create file
|
||||
if(SD.create(logfile)) {
|
||||
USB.println(F("file created"));
|
||||
} else {
|
||||
USB.println(F("file NOT created"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
|
||||
//PWR ON SENSOR
|
||||
PWR.setSensorPower(SENS_3V3,SENS_ON);
|
||||
Utils.setLED(LED1, LED_ON);
|
||||
|
||||
//READ VALUE
|
||||
reading = analogRead(SENSOR_PIN);
|
||||
delay(delay_reading / 2);
|
||||
|
||||
//PWR OFF SENSOR
|
||||
Utils.setLED(LED1, LED_OFF);
|
||||
PWR.setSensorPower(SENS_3V3,SENS_OFF);
|
||||
|
||||
//WRITE DATA TO FILE (may need some convertion here...)
|
||||
Utils.long2array(reading, reading_buff);
|
||||
SD.appendln(logfile, reading_buff);
|
||||
|
||||
USB.println(reading_buff);
|
||||
|
||||
delay(delay_reading / 2);
|
||||
}
|
||||
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
#include <WaspSensorPrototyping_v20.h>
|
||||
|
||||
int delay_reading = 500;
|
||||
|
||||
char reading_buff[20];
|
||||
|
||||
// define folder and file to store data
|
||||
char* logfile="log.csv";
|
||||
|
||||
void setup() {
|
||||
|
||||
USB.ON();
|
||||
|
||||
SD.ON();
|
||||
|
||||
// delete file
|
||||
if(SD.del(logfile)) {
|
||||
USB.println(F("file deleted"));
|
||||
} else {
|
||||
USB.println(F("file NOT deleted"));
|
||||
}
|
||||
|
||||
// create file
|
||||
if(SD.create(logfile)) {
|
||||
USB.println(F("file created"));
|
||||
} else {
|
||||
USB.println(F("file NOT created"));
|
||||
}
|
||||
|
||||
delay(100);
|
||||
|
||||
// Sensor board
|
||||
SensorProtov20.ON();
|
||||
// RTC
|
||||
RTC.ON();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
|
||||
Utils.setLED(LED1, LED_ON);
|
||||
|
||||
float adc = SensorProtov20.readADC();
|
||||
|
||||
Utils.float2String(adc, reading_buff, 6);
|
||||
|
||||
delay(delay_reading / 2);
|
||||
|
||||
Utils.setLED(LED1, LED_OFF);
|
||||
|
||||
SD.appendln(logfile, reading_buff);
|
||||
|
||||
USB.println(reading_buff);
|
||||
|
||||
delay(delay_reading / 2);
|
||||
}
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
#define SENSOR_PIN ANALOG2
|
||||
|
||||
int delay_reading = 100;
|
||||
char reading_buff[20];
|
||||
|
||||
// define folder and file to store data
|
||||
char* logfile="log.csv";
|
||||
|
||||
|
||||
void setup() {
|
||||
|
||||
USB.ON();
|
||||
|
||||
SD.ON();
|
||||
|
||||
// delete file
|
||||
if(SD.del(logfile)) {
|
||||
USB.println(F("file deleted"));
|
||||
} else {
|
||||
USB.println(F("file NOT deleted"));
|
||||
}
|
||||
|
||||
// create file
|
||||
if(SD.create(logfile)) {
|
||||
USB.println(F("file created"));
|
||||
} else {
|
||||
USB.println(F("file NOT created"));
|
||||
}
|
||||
|
||||
// accelerometer
|
||||
ACC.ON();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
|
||||
Utils.setLED(LED1, LED_ON);
|
||||
|
||||
sprintf(reading_buff, "%d,%d,%d", ACC.getX(), ACC.getY(), ACC.getZ());
|
||||
|
||||
delay(delay_reading / 2);
|
||||
|
||||
//PWR OFF SENSOR
|
||||
Utils.setLED(LED1, LED_OFF);
|
||||
|
||||
SD.appendln(logfile, reading_buff);
|
||||
|
||||
USB.println(reading_buff);
|
||||
|
||||
delay(delay_reading / 2);
|
||||
}
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
#define SENSOR_PIN ANALOG2
|
||||
|
||||
int delay_reading = 100;
|
||||
char reading_buff[20];
|
||||
|
||||
// define folder and file to store data
|
||||
char* logfile="log.csv";
|
||||
|
||||
|
||||
void setup() {
|
||||
|
||||
USB.ON();
|
||||
|
||||
SD.ON();
|
||||
|
||||
// delete file
|
||||
if(SD.del(logfile)) {
|
||||
USB.println(F("file deleted"));
|
||||
} else {
|
||||
USB.println(F("file NOT deleted"));
|
||||
}
|
||||
|
||||
// create file
|
||||
if(SD.create(logfile)) {
|
||||
USB.println(F("file created"));
|
||||
} else {
|
||||
USB.println(F("file NOT created"));
|
||||
}
|
||||
|
||||
// RTC
|
||||
RTC.ON();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
|
||||
Utils.setLED(LED1, LED_ON);
|
||||
|
||||
float temp = RTC.getTemperature();
|
||||
|
||||
Utils.float2String(temp, reading_buff, 3);
|
||||
|
||||
delay(delay_reading / 2);
|
||||
|
||||
//PWR OFF SENSOR
|
||||
Utils.setLED(LED1, LED_OFF);
|
||||
|
||||
SD.appendln(logfile, reading_buff);
|
||||
|
||||
USB.println(reading_buff);
|
||||
|
||||
delay(delay_reading / 2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user