baseline reader code

baseline reader code

error: pathspec 'BaselineReading/BaselineReading.ino' did not match any file(s) known to git

--- BaselineReading/BaselineReading.ino
+++ BaselineReading/BaselineReading.ino
@@ -0,0 +1,107 @@
+#include <CurieIMU.h>
+#include <MadgwickAHRS.h>
+#include <NewPing.h>
+
+// ULTRASONIC
+#define TRIGGER_PIN_1  12  // Arduino pin tied to trigger pin on the ultrasonic sensor.
+#define ECHO_PIN_1     11  // Arduino pin tied to echo pin on the ultrasonic sensor.
+#define TRIGGER_PIN_2  10  // Arduino pin tied to trigger pin on the ultrasonic sensor.
+#define ECHO_PIN_2     9  // Arduino pin tied to echo pin on the ultrasonic sensor.
+
+#define DETECTION_THRESH 50 // Distance cutoff for passing
+#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
+
+NewPing sonar_1(TRIGGER_PIN_1, ECHO_PIN_1, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
+NewPing sonar_2(TRIGGER_PIN_2, ECHO_PIN_2, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
+
+// MADGEWICK
+Madgwick filter;
+unsigned long microsPerReading, microsPrevious;
+float accelScale, gyroScale;
+
+// SETUP
+void setup() {
+  Serial.begin(9600);
+
+  // start the IMU and filter
+  CurieIMU.begin();
+  CurieIMU.setGyroRate(25);
+  CurieIMU.setAccelerometerRate(25);
+  filter.begin(25);
+
+  // Set the accelerometer range to 2G
+  CurieIMU.setAccelerometerRange(2);
+  // Set the gyroscope range to 250 degrees/second
+  CurieIMU.setGyroRange(250);
+
+  // initialize variables to pace updates to correct rate
+  microsPerReading = 1000000 / 25;
+  microsPrevious = micros();
+}
+
+void loop() {
+  int aix, aiy, aiz;
+  int gix, giy, giz;
+  float ax, ay, az;
+  float gx, gy, gz;
+  float doorAngle;
+  int ping_1, ping_2;
+  unsigned long microsNow;
+
+  // check if it's time to read data and update the filter
+  microsNow = micros();
+  if (microsNow - microsPrevious >= microsPerReading) {
+
+    // read raw data from CurieIMU
+    CurieIMU.readMotionSensor(aix, aiy, aiz, gix, giy, giz);
+
+    // convert from raw data to gravity and degrees/second units
+    ax = convertRawAcceleration(aix);
+    ay = convertRawAcceleration(aiy);
+    az = convertRawAcceleration(aiz);
+    gx = convertRawGyro(gix);
+    gy = convertRawGyro(giy);
+    gz = convertRawGyro(giz);
+
+    // update the filter, which computes orientation
+    filter.updateIMU(gx, gy, gz, ax, ay, az);
+
+    // print the heading, pitch and roll
+    doorAngle = filter.getYaw();
+    Serial.print("Door Angle: ");
+    Serial.println(doorAngle);
+
+    ping_1 = sonar_1.ping_cm();
+    ping_2 = sonar_2.ping_cm();
+    printpings(ping_1, ping_2);
+
+    // increment previous time, so we keep proper pace
+    microsPrevious = microsPrevious + microsPerReading;
+  }
+}
+
+float convertRawAcceleration(int aRaw) {
+  // since we are using 2G range
+  // -2g maps to a raw value of -32768
+  // +2g maps to a raw value of 32767
+
+  float a = (aRaw * 2.0) / 32768.0;
+  return a;
+}
+
+float convertRawGyro(int gRaw) {
+  // since we are using 250 degrees/seconds range
+  // -250 maps to a raw value of -32768
+  // +250 maps to a raw value of 32767
+
+  float g = (gRaw * 250.0) / 32768.0;
+  return g;
+}
+
+void printpings(int ping_1, int ping_2) {
+  Serial.print("Ping 1: ");
+  Serial.print(ping_1); // Send ping, get distance in cm and print result (0 = outside set distance range)
+  Serial.print(" cm | Ping 2: ");
+  Serial.print(ping_2); // Send ping, get distance in cm and print result (0 = outside set distance range)
+  Serial.println(" cm");
+}


A Ripple Without Time

A Ripple Without Time

error: pathspec 'examples/timeless-curtain/timeless-curtain.ino' did not match any file(s) known to git

--- examples/timeless-curtain/timeless-curtain.ino
+++ examples/timeless-curtain/timeless-curtain.ino
@@ -0,0 +1,69 @@
+#include "pixelmap/pixelmap.h"
+#include <FastLED.h>
+#include <Logging.h>
+
+// Weird thing I had to do to get the Logging library working with teensy
+extern "C"{
+  int _getpid(){ return -1;}
+  int _kill(int pid, int sig){ return -1; }
+  int _write(){return -1;}
+}
+
+#define LOGLEVEL LOG_LEVEL_INFOS
+
+using namespace pixelmap;
+
+Input* input;
+
+LEDStrip strip = LEDStrip(150);
+LEDs leds = LEDs(&strip, 0, 150);
+
+Visualization* viz;
+CurtainAnimation* anim;
+
+void setup() {
+  Log.Init(LOGLEVEL, 9600);
+  delay(1000);
+  Log.Info("Starting setup()\n");
+  Serial.flush();
+  delay(1000);
+
+  //input = new NoteInput();
+  input = new MSGEQ7Input(
+    1,    // left pin
+    0,    // right pin
+    12,   // strobe pin
+    13,   // reset pin,
+    1000, // max amplitude
+    250   // min amplutide
+  );
+
+  viz = new RippleVisualization(input, 1, 0);
+
+  anim = new CurtainAnimation(viz, leds);
+
+  anim->init(
+     25,    // height in pixels
+     6,     // width in pixels
+     1.0,   // height in ratio of visualiation
+     0.25,  // width in ratio of visualiation
+     0.0,   // rotation in radians
+     0.25,  // x distance from visualization start in ratio of visualization
+    -0.5,   // y "
+     0.0);  // z "
+
+  FastLED.addLeds<WS2811, 6, RGB>(strip.leds, 150);
+  FastLED.show();
+
+  Looper* looper = Looper::instance();
+  looper->addInput(input);
+  looper->addVisualization(viz);
+  looper->addAnimation(anim);
+
+  Log.Info("Finished setup()\n");
+  delay(100);
+}
+
+void loop() {
+  Looper::instance()->loop();
+}


current measure

current measure

error: pathspec 'ACS712_current_measure/ACS712_current_measure.ino' did not match any file(s) known to git

--- ACS712_current_measure/ACS712_current_measure.ino
+++ ACS712_current_measure/ACS712_current_measure.ino
@@ -0,0 +1,27 @@
+/**
+ * Podłączamy miernik szeregowo, jest on amperomierzem.
+ * Jeśli chcemy z niego zrobić woltomierz to podłączamy
+ * szeregowo opornik (w przykładzie 1000
+ */
+int analogPin = A0;
+int val = 0;
+int sensitivity = 100;
+int offsetVoltage = 2500;
+double adcVoltage = 0;
+double currentValue = 0;
+int resistorOmh = 250;
+
+void setup() {
+ Serial.begin(9600);
+}
+
+void loop() {
+  val = analogRead(analogPin);
+  adcVoltage = (val / 1024.0)*5000;
+  currentValue = ((adcVoltage - offsetVoltage) / sensitivity);
+  Serial.print(currentValue*resistorOmh);
+  Serial.println(" V");
+  Serial.println(currentValue);
+  Serial.println(" A");
+  delay(500);
+}


Added current_testing.ino

Added current_testing.ino

error: pathspec 'Kirbi/testing/current_testing/current_testing.ino' did not match any file(s) known to git

--- Kirbi/testing/current_testing/current_testing.ino
+++ Kirbi/testing/current_testing/current_testing.ino
@@ -0,0 +1,13 @@
+void setup() {
+  // put your setup code here, to run once:
+  pinMode(A21, INPUT);
+  analogReadResolution(13);
+  Serial.begin(115200);
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+  double current = analogRead(A21).00805664;
+  Serial.println(current);
+  delay(100);
+}