diff --git a/jacopad/arduino/README.md b/jacopad/arduino/README.md deleted file mode 100644 index a49c909..0000000 --- a/jacopad/arduino/README.md +++ /dev/null @@ -1 +0,0 @@ -# JacoPad Arduino diff --git a/jacopad/arduino/main.cpp b/jacopad/arduino/main.cpp deleted file mode 100644 index 8830cfe..0000000 --- a/jacopad/arduino/main.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -#include "token.h" - -// Define array of limits for token j1 -float limits1[3] = {1000.0, 4000.0, 7500.0}; - -// Create an instance of Token class named j1 with specified parameters -Token j1(1, 15000, limits1, 400, 10000); - -void setup() { - Serial.begin(9600); // Initialize serial communication at 9600 baud rate -} - -void loop() { - // Read the sensor value and print it along with the token type - Serial.print(j1.read()); // Print the adjusted sensor value - Serial.print(" "); // Print separator - Serial.println(j1.type()); // Print the type of token based on the sensor value - - delay(1000); // Delay for 1 second before next reading (adjust as needed) -} \ No newline at end of file diff --git a/jacopad/arduino/token.cpp b/jacopad/arduino/token.cpp deleted file mode 100644 index 1bc009f..0000000 --- a/jacopad/arduino/token.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include - -#include "token.h" - -// Constructor for Token class -Token::Token(int pin, float base, float limits[3], float min, float max) { - m_pin = pin; // Initialize pin number - m_base = base; // Set base value - m_min = min; // Set minimum value - m_max = max; // Set maximum value - for(int i=0; i<3; i++) { - m_limits[i] = limits[i]; // Copy limit values to class member array - } -} - -// Read the analog value from the sensor and calculate the adjusted value -float Token::read() { - float valeurLue = (float)analogRead(m_pin); // Read analog value from specified pin - return (valeurLue * m_base) / (1023.0F - valeurLue); // Perform scaling and return adjusted value -} - -// Determine the type of token based on the read value -int Token::type() { - float value = Token::read(); // Read the token value - if(value < m_min || m_max < value) { - return 0; // Out of range, return type 0 - } - for(int i=0; i<3; i++) { - if(value < m_limits[i]) { - return i + 1; // Return type corresponding to the limit that value is less than - } - } - return 4; // Default type (in range but not matching any specific limit) -} \ No newline at end of file diff --git a/jacopad/arduino/token.h b/jacopad/arduino/token.h deleted file mode 100644 index 3ca611d..0000000 --- a/jacopad/arduino/token.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -// Token class declaration -class Token { -private: - int m_pin; // Pin number connected to the sensor - float m_base; // Base value used for scaling the sensor reading - float m_limits[3]; // Array of limit values for token type determination - float m_min; // Minimum value threshold for token range - float m_max; // Maximum value threshold for token range - -public: - // Constructor declaration - Token(int pin, float base, float limits[3], float min, float max); - - // Method to read sensor value and return adjusted value - float read(); - - // Method to determine and return the type of token based on the sensor value - int type(); -}; \ No newline at end of file