diff --git a/Nose/Nose.ino b/Nose/Nose.ino index 5343d87..5b90c0c 100644 --- a/Nose/Nose.ino +++ b/Nose/Nose.ino @@ -12,134 +12,129 @@ #define SEALEVELPRESSURE_HPA (1013.25) -Adafruit_BME280 bme; +Adafruit_BME280 bme; MCP342X myADC; -CCP_MCP2515 CCP(CAN0_CS, CAN0_INT);//CAN +CCP_MCP2515 CCP(CAN0_CS, CAN0_INT); //CAN unsigned long delayTime; -const int clockFrequency = 400000;//I2C bus speed +const int clockFrequency = 400000; //I2C bus speed bool timer100Hz = false; bool sleep_sensors = false; bool can_checkerflag = false; struct repeating_timer st_timer; void setup() { - Serial.begin(1843200); - Wire.setSDA(6); - Wire.setSCL(7); - Wire.setClock(clockFrequency); - Wire.begin(); - bme.begin(0x76); - myADC.configure( MCP342X_MODE_CONTINUOUS | - MCP342X_CHANNEL_1 | - MCP342X_SIZE_18BIT | - MCP342X_GAIN_1X - ); - add_repeating_timer_us(10000, TimerIsr, NULL, &st_timer);//100Hz - #ifdef CAN_AVAIRABLE - CCP.begin(); - #endif + Serial.begin(1843200); + Wire.setSDA(6); + Wire.setSCL(7); + Wire.setClock(clockFrequency); + Wire.begin(); + bme.begin(0x76); + myADC.configure(MCP342X_MODE_CONTINUOUS | MCP342X_CHANNEL_1 | MCP342X_SIZE_18BIT | MCP342X_GAIN_1X); + add_repeating_timer_us(10000, TimerIsr, NULL, &st_timer); //100Hz +#ifdef CAN_AVAIRABLE + CCP.begin(); +#endif } -void loop() { - static int32_t result; - static float temperature; - static float barometic_pressure; - static char adc_bytes[3]; - static double voltage; - if(timer100Hz){ - timer100Hz = false; - if(!sleep_sensors){ - //差圧センサ関連 - myADC.startConversion(); - myADC.getResult(&result); - DevideBytes(&result, adc_bytes); - ConvertToVoltage(adc_bytes, &voltage); //3つのバイトを電圧に変換 - //BME280関連 - GetBME280Data(&temperature, &barometic_pressure); - //CAN送信 - #ifdef CAN_AVAIRABLE - CCP.uint32_to_device(CCP_nose_adc,voltage); - CCP.float_to_device(CCP_nose_temperature, temperature); - CCP.float_to_device(CCP_nose_barometic_pressure, barometic_pressure); - if(can_checkerflag){ - CCP.string_to_device(CCP_nose_status,"OK"); - can_checkerflag = false; - } - #endif +void loop() { + static int32_t result; + static float temperature; + static float barometic_pressure; + static char adc_bytes[3]; + static double voltage; + if (timer100Hz) { + timer100Hz = false; + if (!sleep_sensors) { + //差圧センサ関連 + myADC.startConversion(); + myADC.getResult(&result); + DevideBytes(&result, adc_bytes); + ConvertToVoltage(adc_bytes, &voltage); //3つのバイトを電圧に変換 + //BME280関連 + GetBME280Data(&temperature, &barometic_pressure); +//CAN送信 +#ifdef CAN_AVAIRABLE + CCP.uint32_to_device(CCP_nose_adc, voltage); + CCP.float_to_device(CCP_nose_temperature, temperature); + CCP.float_to_device(CCP_nose_barometic_pressure, barometic_pressure); + if (can_checkerflag) { + CCP.string_to_device(CCP_nose_status, "OK"); + can_checkerflag = false; + } +#endif - //シリアル出力 - SerialPrintSensors(adc_bytes, temperature, barometic_pressure, voltage); - } + //シリアル出力 + SerialPrintSensors(adc_bytes, temperature, barometic_pressure, voltage); } - #ifdef CAN_AVAIRABLE - CCP.read_device(); - switch (CCP.id) - { + } +#ifdef CAN_AVAIRABLE + CCP.read_device(); + switch (CCP.id) { case CCP_EMST_mesure: - if(CCP.str_match("STOP",4)){ - sleep_sensors = true; - }else if(CCP.str_match("CLEAR", 5)){ - sleep_sensors = false; - } - break; + if (CCP.str_match("STOP", 4)) { + sleep_sensors = true; + } else if (CCP.str_match("CLEAR", 5)) { + sleep_sensors = false; + } + break; case CCP_nose_adc: - if(CCP.str_match("CHECK", 5)){ - can_checkerflag = true; - } - if(CCP.str_match("KILL", 4)){ - sleep_sensors = true; - } - break; + if (CCP.str_match("CHECK", 5)) { + can_checkerflag = true; + } + if (CCP.str_match("KILL", 4)) { + sleep_sensors = true; + } + break; default: - break; - } - #endif + break; + } +#endif } -void GetBME280Data(float* temperature,float* barometic_pressure){ - *temperature=bme.readTemperature(); - *barometic_pressure=bme.readPressure(); +void GetBME280Data(float* temperature, float* barometic_pressure) { + *temperature = bme.readTemperature(); + *barometic_pressure = bme.readPressure(); } -void DevideBytes(int32_t* _result,char* bytes){ - bytes[2] = (char)(*_result & 0xFF); - bytes[1] = (char)((*_result >> 8) & 0xFF); - bytes[0] = (char)((*_result >> 16) & 0xFF); +void DevideBytes(int32_t* _result, char* bytes) { + bytes[2] = (char)(*_result & 0xFF); + bytes[1] = (char)((*_result >> 8) & 0xFF); + bytes[0] = (char)((*_result >> 16) & 0xFF); } -void ConvertToVoltage(char* bytes,double* voltage){ - double pga=1; - double lsb=2*2.048/pow(2,18); +void ConvertToVoltage(char* bytes, double* voltage) { + double pga = 1; + double lsb = 2 * 2.048 / pow(2, 18); - byte msb=(bytes[0]>>6)&0x01; - uint32_t outputcode=bytes[2]|(bytes[1]<<8)|((bytes[0]*0x01)<<16); - if(msb==0x00){//正の値 - *voltage=(double)(outputcode)*lsb/pga; - }else{//負の値 - outputcode=((~outputcode)&0x01FFFF)+1;//2の補数 - *voltage=-(double)(outputcode)*lsb/pga; - } + byte msb = (bytes[0] >> 6) & 0x01; + uint32_t outputcode = bytes[2] | (bytes[1] << 8) | ((bytes[0] * 0x01) << 16); + if (msb == 0x00) { //正の値 + *voltage = (double)(outputcode)*lsb / pga; + } else { //負の値 + outputcode = ((~outputcode) & 0x01FFFF) + 1; //2の補数 + *voltage = -(double)(outputcode)*lsb / pga; + } } -void SerialPrintSensors(char* adc_bytes,float temperature,float barometic_pressure,double voltage){ - // if(timer100Hz) Serial.println("overrun"); - Serial.print("time:"); - Serial.print(micros()); - Serial.print(",adc_bytes:"); - Serial.print(adc_bytes[0],HEX); - Serial.print(adc_bytes[1],HEX); - Serial.print(adc_bytes[2],HEX); - Serial.print(",temperature:"); - Serial.print(temperature,10); - Serial.print(","); - Serial.print(",barometic_pressure:"); - Serial.print(barometic_pressure,10); - Serial.print(",voltage:"); - Serial.println(voltage,10); +void SerialPrintSensors(char* adc_bytes, float temperature, float barometic_pressure, double voltage) { + // if(timer100Hz) Serial.println("overrun"); + Serial.print("time:"); + Serial.print(micros()); + Serial.print(",adc_bytes:"); + Serial.print(adc_bytes[0], HEX); + Serial.print(adc_bytes[1], HEX); + Serial.print(adc_bytes[2], HEX); + Serial.print(",temperature:"); + Serial.print(temperature, 10); + Serial.print(","); + Serial.print(",barometic_pressure:"); + Serial.print(barometic_pressure, 10); + Serial.print(",voltage:"); + Serial.println(voltage, 10); } -bool TimerIsr(struct repeating_timer *t){ - timer100Hz = true; - return true; +bool TimerIsr(struct repeating_timer* t) { + timer100Hz = true; + return true; } \ No newline at end of file diff --git a/test/Nose/BME_high_rate/BME_high_rate.ino b/test/Nose/BME_high_rate/BME_high_rate.ino index f457cab..c96de5c 100644 --- a/test/Nose/BME_high_rate/BME_high_rate.ino +++ b/test/Nose/BME_high_rate/BME_high_rate.ino @@ -4,45 +4,45 @@ #define SEALEVELPRESSURE_HPA (1013.25) -Adafruit_BME280 bme; +Adafruit_BME280 bme; unsigned long delayTime; -const int clockFrequency = 400000;//I2C bus speed +const int clockFrequency = 400000; //I2C bus speed void setup() { - Serial.begin(115200); - unsigned status; - Wire.setSDA(6); - Wire.setSCL(7); - Wire.setClock(clockFrequency); - Wire.begin(); - status = bme.begin(0x76); + Serial.begin(115200); + unsigned status; + Wire.setSDA(6); + Wire.setSCL(7); + Wire.setClock(clockFrequency); + Wire.begin(); + status = bme.begin(0x76); } -void loop() { - printValues(); - delay(5); +void loop() { + printValues(); + delay(5); } void printValues() { - Serial.print("Temperature = "); - Serial.print(bme.readTemperature()); - Serial.println(" °C"); + Serial.print("Temperature = "); + Serial.print(bme.readTemperature()); + Serial.println(" °C"); - Serial.print("Pressure = "); + Serial.print("Pressure = "); - Serial.print(bme.readPressure() / 100.0F); - Serial.println(" hPa"); + Serial.print(bme.readPressure() / 100.0F); + Serial.println(" hPa"); - Serial.print("Approx. Altitude = "); - Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA)); - Serial.println(" m"); + Serial.print("Approx. Altitude = "); + Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA)); + Serial.println(" m"); - Serial.print("Humidity = "); - Serial.print(bme.readHumidity()); - Serial.println(" %"); + Serial.print("Humidity = "); + Serial.print(bme.readHumidity()); + Serial.println(" %"); - Serial.println(); + Serial.println(); } diff --git a/test/Nose/BME_mcp3421/BME_mcp3421.ino b/test/Nose/BME_mcp3421/BME_mcp3421.ino index 5b0b9b9..b66b868 100644 --- a/test/Nose/BME_mcp3421/BME_mcp3421.ino +++ b/test/Nose/BME_mcp3421/BME_mcp3421.ino @@ -1,83 +1,79 @@ #include #include -#include +#include #define SEALEVELPRESSURE_HPA (1013.25) -Adafruit_BME280 bme; +Adafruit_BME280 bme; MCP342X myADC; unsigned long delayTime; -const int clockFrequency = 400000;//I2C bus speed +const int clockFrequency = 400000; //I2C bus speed double voltage; void setup() { - Serial.begin(115200); - unsigned status; - Wire.setSDA(6); - Wire.setSCL(7); - Wire.setClock(clockFrequency); - Wire.begin(); - status = bme.begin(0x76); - myADC.configure( MCP342X_MODE_CONTINUOUS | - MCP342X_CHANNEL_1 | - MCP342X_SIZE_18BIT | - MCP342X_GAIN_1X - ); + Serial.begin(115200); + unsigned status; + Wire.setSDA(6); + Wire.setSCL(7); + Wire.setClock(clockFrequency); + Wire.begin(); + status = bme.begin(0x76); + myADC.configure(MCP342X_MODE_CONTINUOUS | MCP342X_CHANNEL_1 | MCP342X_SIZE_18BIT | MCP342X_GAIN_1X); } -void loop() { - printValues(); +void loop() { + printValues(); - static int32_t result; - byte bytes[4]; - myADC.startConversion(); - myADC.getResult(&result); - ConvertToVoltage(&result,&voltage); - Serial.print("voltage:"); - Serial.println(voltage,10); - delay(5); + static int32_t result; + byte bytes[4]; + myADC.startConversion(); + myADC.getResult(&result); + ConvertToVoltage(&result, &voltage); + Serial.print("voltage:"); + Serial.println(voltage, 10); + delay(5); } void printValues() { - Serial.print("Temperature = "); - Serial.print(bme.readTemperature()); - Serial.println(" °C"); + Serial.print("Temperature = "); + Serial.print(bme.readTemperature()); + Serial.println(" °C"); - Serial.print("Pressure = "); + Serial.print("Pressure = "); - Serial.print(bme.readPressure() / 100.0F); - Serial.println(" hPa"); + Serial.print(bme.readPressure() / 100.0F); + Serial.println(" hPa"); - Serial.print("Approx. Altitude = "); - Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA)); - Serial.println(" m"); + Serial.print("Approx. Altitude = "); + Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA)); + Serial.println(" m"); - Serial.print("Humidity = "); - Serial.print(bme.readHumidity()); - Serial.println(" %"); + Serial.print("Humidity = "); + Serial.print(bme.readHumidity()); + Serial.println(" %"); - Serial.println(); + Serial.println(); } -void ConvertToVoltage(int32_t* _result,double* voltage){ +void ConvertToVoltage(int32_t* _result, double* voltage) { byte bytes[4]; bytes[3] = (char)(*_result & 0xFF); bytes[2] = (char)((*_result >> 8) & 0xFF); - bytes[1] = (char)((*_result >> 16) & 0xFF); - bytes[0] = (char)((*_result >> 24) & 0xFF); //ライブラリの関数内で8bit右シフトしたときに発生したものなので無視 - double pga=1; - double lsb=2*2.048/pow(2,18); - - byte msb=(bytes[1]>>6)&0x01; - uint32_t outputcode=bytes[3]|(bytes[2]<<8)|((bytes[1]*0x01)<<16); - if(msb==0x00){//正の値 - *voltage=(double)(outputcode)*lsb/pga; - }else{//負の値 - outputcode=((~outputcode)&0x01FFFF)+1;//2の補数 - *voltage=-(double)(outputcode)*lsb/pga; + bytes[1] = (char)((*_result >> 16) & 0xFF); + bytes[0] = (char)((*_result >> 24) & 0xFF); //ライブラリの関数内で8bit右シフトしたときに発生したものなので無視 + double pga = 1; + double lsb = 2 * 2.048 / pow(2, 18); + + byte msb = (bytes[1] >> 6) & 0x01; + uint32_t outputcode = bytes[3] | (bytes[2] << 8) | ((bytes[1] * 0x01) << 16); + if (msb == 0x00) { //正の値 + *voltage = (double)(outputcode)*lsb / pga; + } else { //負の値 + outputcode = ((~outputcode) & 0x01FFFF) + 1; //2の補数 + *voltage = -(double)(outputcode)*lsb / pga; } } diff --git a/test/Nose/bme280test/bme280test.ino b/test/Nose/bme280test/bme280test.ino index 89bb5ef..079a7fd 100644 --- a/test/Nose/bme280test/bme280test.ino +++ b/test/Nose/bme280test/bme280test.ino @@ -4,43 +4,43 @@ #define SEALEVELPRESSURE_HPA (1013.25) -Adafruit_BME280 bme; +Adafruit_BME280 bme; unsigned long delayTime; void setup() { - Serial.begin(9600); - unsigned status; - Wire.setSDA(6); - Wire.setSCL(7); - Wire.begin(); - status = bme.begin(0x76); + Serial.begin(9600); + unsigned status; + Wire.setSDA(6); + Wire.setSCL(7); + Wire.begin(); + status = bme.begin(0x76); } -void loop() { - printValues(); - delay(1000); +void loop() { + printValues(); + delay(1000); } void printValues() { - Serial.print("Temperature = "); - Serial.print(bme.readTemperature()); - Serial.println(" °C"); + Serial.print("Temperature = "); + Serial.print(bme.readTemperature()); + Serial.println(" °C"); - Serial.print("Pressure = "); + Serial.print("Pressure = "); - Serial.print(bme.readPressure() / 100.0F); - Serial.println(" hPa"); + Serial.print(bme.readPressure() / 100.0F); + Serial.println(" hPa"); - Serial.print("Approx. Altitude = "); - Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA)); - Serial.println(" m"); + Serial.print("Approx. Altitude = "); + Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA)); + Serial.println(" m"); - Serial.print("Humidity = "); - Serial.print(bme.readHumidity()); - Serial.println(" %"); + Serial.print("Humidity = "); + Serial.print(bme.readHumidity()); + Serial.println(" %"); - Serial.println(); + Serial.println(); } diff --git a/test/Nose/mcp3421_2/mcp3421_2.ino b/test/Nose/mcp3421_2/mcp3421_2.ino index c909d45..3181ce3 100644 --- a/test/Nose/mcp3421_2/mcp3421_2.ino +++ b/test/Nose/mcp3421_2/mcp3421_2.ino @@ -1,46 +1,42 @@ -#include -#include +#include +#include MCP342X myADC; double voltage; void setup() { - Wire.begin(); // join I2C bus -// TWBR = 12; // 400 kHz (maximum) - Serial.begin(9600); // Open serial connection to send info to the host - myADC.configure( MCP342X_MODE_CONTINUOUS | - MCP342X_CHANNEL_1 | - MCP342X_SIZE_18BIT | - MCP342X_GAIN_1X - ); + Wire.begin(); // join I2C bus + // TWBR = 12; // 400 kHz (maximum) + Serial.begin(9600); // Open serial connection to send info to the host + myADC.configure(MCP342X_MODE_CONTINUOUS | MCP342X_CHANNEL_1 | MCP342X_SIZE_18BIT | MCP342X_GAIN_1X); delay(300); } void loop() { - static int32_t result; + static int32_t result; byte bytes[4]; myADC.startConversion(); myADC.getResult(&result); - ConvertToVoltage(&result,&voltage); + ConvertToVoltage(&result, &voltage); Serial.print("voltage:"); Serial.println(voltage); -} -void ConvertToVoltage(int32_t* _result,double* voltage){ +} +void ConvertToVoltage(int32_t* _result, double* voltage) { byte bytes[4]; bytes[3] = (char)(*_result & 0xFF); bytes[2] = (char)((*_result >> 8) & 0xFF); - bytes[1] = (char)((*_result >> 16) & 0xFF); - bytes[0] = (char)((*_result >> 24) & 0xFF); //ライブラリの関数内で8bit右シフトしたときに発生したものなので無視 - double pga=1; - double lsb=2*2.048/pow(2,18); - - byte msb=(bytes[1]>>6)&0x01; - uint32_t outputcode=bytes[3]|(bytes[2]<<8)|((bytes[1]*0x01)<<16); - if(msb==0x00){//正の値 - *voltage=(double)(outputcode)*lsb/pga; - }else{//負の値 - outputcode=((~outputcode)&0x01FFFF)+1;//2の補数 - *voltage=-(double)(outputcode)*lsb/pga; + bytes[1] = (char)((*_result >> 16) & 0xFF); + bytes[0] = (char)((*_result >> 24) & 0xFF); //ライブラリの関数内で8bit右シフトしたときに発生したものなので無視 + double pga = 1; + double lsb = 2 * 2.048 / pow(2, 18); + + byte msb = (bytes[1] >> 6) & 0x01; + uint32_t outputcode = bytes[3] | (bytes[2] << 8) | ((bytes[1] * 0x01) << 16); + if (msb == 0x00) { //正の値 + *voltage = (double)(outputcode)*lsb / pga; + } else { //負の値 + outputcode = ((~outputcode) & 0x01FFFF) + 1; //2の補数 + *voltage = -(double)(outputcode)*lsb / pga; } } \ No newline at end of file diff --git a/test/Nose/mcp3421_pico/mcp3421_pico.ino b/test/Nose/mcp3421_pico/mcp3421_pico.ino index 4f52ac2..876e95c 100644 --- a/test/Nose/mcp3421_pico/mcp3421_pico.ino +++ b/test/Nose/mcp3421_pico/mcp3421_pico.ino @@ -1,6 +1,6 @@ -#include -#include +#include +#include #define PIN1_SDA 6 #define PIN1_SCL 7 @@ -10,42 +10,38 @@ double voltage; void setup() { Wire.setSDA(PIN1_SDA); Wire.setSCL(PIN1_SCL); - Wire.begin(); // join I2C bus -// TWBR = 12; // 400 kHz (maximum) - Serial.begin(9600); // Open serial connection to send info to the host - myADC.configure( MCP342X_MODE_CONTINUOUS | - MCP342X_CHANNEL_1 | - MCP342X_SIZE_18BIT | - MCP342X_GAIN_1X - ); + Wire.begin(); // join I2C bus + // TWBR = 12; // 400 kHz (maximum) + Serial.begin(9600); // Open serial connection to send info to the host + myADC.configure(MCP342X_MODE_CONTINUOUS | MCP342X_CHANNEL_1 | MCP342X_SIZE_18BIT | MCP342X_GAIN_1X); delay(300); } void loop() { - static int32_t result; + static int32_t result; byte bytes[4]; myADC.startConversion(); myADC.getResult(&result); - ConvertToVoltage(&result,&voltage); + ConvertToVoltage(&result, &voltage); Serial.print("voltage:"); - Serial.println(voltage,10); -} -void ConvertToVoltage(int32_t* _result,double* voltage){ + Serial.println(voltage, 10); +} +void ConvertToVoltage(int32_t* _result, double* voltage) { byte bytes[4]; bytes[3] = (char)(*_result & 0xFF); bytes[2] = (char)((*_result >> 8) & 0xFF); - bytes[1] = (char)((*_result >> 16) & 0xFF); - bytes[0] = (char)((*_result >> 24) & 0xFF); //ライブラリの関数内で8bit右シフトしたときに発生したものなので無視 - double pga=1; - double lsb=2*2.048/pow(2,18); - - byte msb=(bytes[1]>>6)&0x01; - uint32_t outputcode=bytes[3]|(bytes[2]<<8)|((bytes[1]*0x01)<<16); - if(msb==0x00){//正の値 - *voltage=(double)(outputcode)*lsb/pga; - }else{//負の値 - outputcode=((~outputcode)&0x01FFFF)+1;//2の補数 - *voltage=-(double)(outputcode)*lsb/pga; + bytes[1] = (char)((*_result >> 16) & 0xFF); + bytes[0] = (char)((*_result >> 24) & 0xFF); //ライブラリの関数内で8bit右シフトしたときに発生したものなので無視 + double pga = 1; + double lsb = 2 * 2.048 / pow(2, 18); + + byte msb = (bytes[1] >> 6) & 0x01; + uint32_t outputcode = bytes[3] | (bytes[2] << 8) | ((bytes[1] * 0x01) << 16); + if (msb == 0x00) { //正の値 + *voltage = (double)(outputcode)*lsb / pga; + } else { //負の値 + outputcode = ((~outputcode) & 0x01FFFF) + 1; //2の補数 + *voltage = -(double)(outputcode)*lsb / pga; } } \ No newline at end of file diff --git a/test/Nose/mcp3421check_samd/mcp3421check_samd.ino b/test/Nose/mcp3421check_samd/mcp3421check_samd.ino index 4e65345..5675879 100644 --- a/test/Nose/mcp3421check_samd/mcp3421check_samd.ino +++ b/test/Nose/mcp3421check_samd/mcp3421check_samd.ino @@ -1,37 +1,33 @@ // Include libraries this sketch will use -#include -#include +#include +#include // Instantiate objects used in this project MCP342X myADC; void setup() { Wire.begin(); // join I2C bus -// TWBR = 12; // 400 kHz (maximum) - - Serial.begin(9600); // Open serial connection to send info to the host - while (!Serial) {} // wait for Serial comms to become ready + // TWBR = 12; // 400 kHz (maximum) + + Serial.begin(9600); // Open serial connection to send info to the host + while (!Serial) {} // wait for Serial comms to become ready Serial.println("Starting up"); Serial.println("Testing device connection..."); - Serial.println(myADC.testConnection() ? "MCP342X connection successful" : "MCP342X connection failed"); - - myADC.configure( MCP342X_MODE_CONTINUOUS | - MCP342X_CHANNEL_1 | - MCP342X_SIZE_16BIT | - MCP342X_GAIN_1X - ); + Serial.println(myADC.testConnection() ? "MCP342X connection successful" : "MCP342X connection failed"); + + myADC.configure(MCP342X_MODE_CONTINUOUS | MCP342X_CHANNEL_1 | MCP342X_SIZE_16BIT | MCP342X_GAIN_1X); Serial.println(myADC.getConfigRegShdw(), HEX); - + } // End of setup() void loop() { - static int16_t result; - + static int16_t result; + myADC.startConversion(); myADC.getResult(&result); - + Serial.println(result, HEX); - + } // End of loop() diff --git a/test/Nose/xiaotest/xiaotest.ino b/test/Nose/xiaotest/xiaotest.ino index af8cc35..0b0de86 100644 --- a/test/Nose/xiaotest/xiaotest.ino +++ b/test/Nose/xiaotest/xiaotest.ino @@ -1,9 +1,9 @@ -void setup(){ - pinMode(13, OUTPUT); +void setup() { + pinMode(13, OUTPUT); } -void loop(){ - digitalWrite(13, HIGH); - delay(1000); - digitalWrite(13, LOW); - delay(1000); +void loop() { + digitalWrite(13, HIGH); + delay(1000); + digitalWrite(13, LOW); + delay(1000); } \ No newline at end of file