move wip stuff to wip
This commit is contained in:
41
wip/tekubi/Makefile
Normal file
41
wip/tekubi/Makefile
Normal file
@@ -0,0 +1,41 @@
|
||||
i2cdevlib_url = https://github.com/jrowberg/i2cdevlib.git
|
||||
|
||||
setup: I2Cdev.cpp I2Cdev.h MPU6050.cpp MPU6050.h
|
||||
|
||||
clean_setup:
|
||||
rm -rf i2cdevlib i2cdevlib_tmp
|
||||
rm -f I2Cdev.cpp I2Cdev.h
|
||||
rm -f MPU6050.cpp MPU6050.h
|
||||
|
||||
i2cdevlib:
|
||||
rm -rf i2cdevlib_tmp
|
||||
git init i2cdevlib_tmp
|
||||
git -C i2cdevlib_tmp remote add -f origin $(i2cdevlib_url)
|
||||
git -C i2cdevlib_tmp config core.sparseCheckout true
|
||||
git -C i2cdevlib_tmp sparse-checkout set
|
||||
git -C i2cdevlib_tmp checkout master
|
||||
mv i2cdevlib_tmp i2cdevlib
|
||||
|
||||
i2cdevlib/Arduino/I2Cdev: i2cdevlib
|
||||
git -C i2cdevlib sparse-checkout add Arduino/I2Cdev
|
||||
git -C i2cdevlib sparse-checkout reapply
|
||||
git fetch
|
||||
|
||||
i2cdevlib/Arduino/MPU6050: i2cdevlib
|
||||
git -C i2cdevlib sparse-checkout add Arduino/MPU6050
|
||||
git -C i2cdevlib sparse-checkout reapply
|
||||
git fetch
|
||||
|
||||
I2Cdev.cpp: i2cdevlib/Arduino/I2Cdev
|
||||
cp i2cdevlib/Arduino/I2Cdev/I2Cdev.cpp ./
|
||||
|
||||
I2Cdev.h: i2cdevlib/Arduino/I2Cdev
|
||||
cp i2cdevlib/Arduino/I2Cdev/I2Cdev.h ./
|
||||
|
||||
MPU6050.cpp: i2cdevlib/Arduino/MPU6050
|
||||
cp i2cdevlib/Arduino/MPU6050/MPU6050.cpp ./
|
||||
|
||||
MPU6050.h: i2cdevlib/Arduino/MPU6050
|
||||
cp i2cdevlib/Arduino/MPU6050/MPU6050.h ./
|
||||
|
||||
.PHONY: setup clean_setup
|
||||
89
wip/tekubi/main.ino
Normal file
89
wip/tekubi/main.ino
Normal file
@@ -0,0 +1,89 @@
|
||||
#define RAD_PIN 0
|
||||
#define ECG_PIN 14 /* A0 */
|
||||
/* TEKUBI
|
||||
* ___________ ________________________________
|
||||
* | | | |
|
||||
* | USB POWER | | TEENSY 4.0 |
|
||||
* | | | |
|
||||
* |__GND__5V__| |__Vin__GND__D0__SDA0__SCL0__A0__|
|
||||
* | | | | | | | |
|
||||
* | +--------+----|---|-+--|-----|----|----------+
|
||||
* | | | | | | | | |
|
||||
* +----|-------------+---|-|--|-----|----|-----+ |
|
||||
* | | | | | | | | | |
|
||||
* | | +---------|---+ | +---+ | +-+ | |
|
||||
* __ | __ |__ | __ __ | __ |____ | | | ____ | __ | __
|
||||
* | GND 5V INT | | GND Vcc | | | | | GND Vcc |
|
||||
* | (100mA?) | | (10mA) SDA--+ | +-A (4mA) |
|
||||
* | | | | | | |
|
||||
* | GEIGER COUNTER | | GYRO SCL----+ | ECG |
|
||||
* |________________| |______________| |______________| */
|
||||
|
||||
/* geiger counter
|
||||
* https://www.rhelectronics.store
|
||||
* /radiation-detector-geiger-counter-diy-kit-second-edition */
|
||||
#include <SPI.h>
|
||||
#define RAD_LOG_PERIOD 5000 /* milliseconds; sample rate */
|
||||
#define MINUTE 60000 /* milliseconds in a minute */
|
||||
/* https://www.arduino.cc/reference/en/language/variables/data-types/
|
||||
* unsignedlong/ - 32 bit */
|
||||
unsigned long rad_count = 0;
|
||||
unsigned long rad_cpm;
|
||||
void rad_interrupt(){ ++rad_count; }
|
||||
/* https://www.pjrc.com/teensy/td_timing_elaspedMillis.html */
|
||||
elapsedMillis rad_period = 0;
|
||||
void geiger_setup(){
|
||||
pinMode(RAD_PIN, INPUT);
|
||||
digitalWrite(RAD_PIN, HIGH);
|
||||
attachInterrupt(0, rad_interrupt, FALLING);
|
||||
}
|
||||
void geiger_loop(){
|
||||
if(rad_period > RAD_LOG_PERIOD){
|
||||
rad_cpm = rad_count * (MINUTE / RAD_LOG_PERIOD);
|
||||
rad_period = 0;
|
||||
}
|
||||
/* use rad_cpm */
|
||||
}
|
||||
|
||||
/* gyro
|
||||
* https://www.elecrow.com/crowtail-mpu6050-accelerometer-gyro.html */
|
||||
/* https://github.com/jrowberg/i2cdevlib/
|
||||
* Most inexplicable stuff is because it was in Arduino/MPU6050/examples/
|
||||
* MPU6050_raw/MPU6050_raw.ino */
|
||||
#include "I2Cdev.h"
|
||||
#include "MPU6050.h"
|
||||
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
|
||||
# include "Wire.h"
|
||||
#endif
|
||||
MPU6050 accelgyro;
|
||||
int16_t accel_x, accel_y, accel_z, gyro_x, gyro_y, gyro_z;
|
||||
void gyro_setup(){
|
||||
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
|
||||
Wire.begin();
|
||||
#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
|
||||
Fastwire::setup(400, true);
|
||||
#endif
|
||||
accelgyro.initialize();
|
||||
}
|
||||
void gyro_loop(){
|
||||
accelgyro.getMotion6(&accel_x, &accel_y, &accel_z,
|
||||
&gyro_x, &gyro_y, &gyro_z);
|
||||
/* use accel_*, gyro_* */
|
||||
}
|
||||
|
||||
/* ecg
|
||||
* https://www.elecrow.com/crowtail-pulse-sensor-p-1673.html */
|
||||
void ecg_setup(){
|
||||
}
|
||||
|
||||
/* teensy 4.0
|
||||
* https://www.pjrc.com/store/teensy40.html */
|
||||
void setup(){
|
||||
geiger_setup();
|
||||
gyro_setup();
|
||||
ecg_setup();
|
||||
}
|
||||
void loop(){
|
||||
geiger_loop();
|
||||
gyro_loop();
|
||||
}
|
||||
Reference in New Issue
Block a user