OPEnSLab-OSU / Loom-V4

Open Source Internet Of Things Rapid Prototyping Framework For Environmental Sensing Applications
5 stars 1 forks source link

Loom Digital unstable #86

Closed udellc closed 9 months ago

udellc commented 10 months ago

Describe the bug The digital module for reporting states of pins seems unstable in the Watson example. I am getting random noise 1,0 flipping a lot when button is not pressed. When button is attached to ground by being mechanically pressed, it remains at 0. This looks like input_Pullup is not being enabled - just vanilla input. Is there something I am missing to specify input, output, or input_pullup using Loom_Digital digital(manager, 10); ?

Hardware in Use Watson kit, button on pin 10, one end attached to ground, normally open

/**
 * This is an example use case for using the MPU gyroscope in conjunction with max
 * 
 * MANAGER MUST BE INCLUDED FIRST IN ALL CODE
 */
//#include "arduino_secrets.h"

#include <Loom_Manager.h>

#include <Internet/Connectivity/Loom_Wifi/Loom_Wifi.h>
#include <Internet/Communication/Loom_Max.h>
#include <Sensors/I2C/Loom_MPU6050/Loom_MPU6050.h>
#include <Sensors/Loom_Analog/Loom_Analog.h>
#include <Sensors/Loom_Digital/Loom_Digital.h>
#include <Hardware/Actuators/Loom_Neopixel/Loom_Neopixel.h>

Manager manager("Wattson", 8);
Loom_WIFI wifi(manager, CommunicationMode::AP); // For AP
//Loom_WIFI wifi(manager, CommunicationMode::CLIENT, SECRET_SSID, SECRET_PASS); // For Client
Loom_Max maxMsp(manager, wifi, new Loom_Neopixel());

Loom_MPU6050 mpu(manager);
// Read the battery voltage and A0 and A1
Loom_Analog analog(manager, A0, A1);
// Reads the button on pin 10
Loom_Digital digital(manager, 10);

void setup() {

  manager.beginSerial();
  manager.initialize();
}

void loop() {
  manager.measure();
  manager.package();
  manager.display_data();

  // Send and Recieve data from Max
  maxMsp.publish();
  maxMsp.subscribe();
  manager.pause(50);
}
udellc commented 9 months ago

Pin state now added as parameter to digital module, e.g INPUT, INPUT_PULLUP, INPUT_PULLDOWN, OUTPUT