Skip to content
Snippets Groups Projects
Commit 33ee1282 authored by Karol Hennessy's avatar Karol Hennessy
Browse files

adding platformio

parent e4e391c3
Branches
No related merge requests found
*~
......@@ -3,5 +3,6 @@ rpi-swlist:
- cowsay
- openssh-server
- minicom
- python3-serial
python3 -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/develop/scripts/get-platformio.py)"
# add to path /home/karol/.platformio/penv/bin
pio lib install VariableTimedAction
pio run -e uno -t upload
[env:uno]
platform = atmelavr
framework = arduino
board = uno
[env:mkrwifi1010]
platform = atmelsam
framework = arduino
board = mkrwifi1010
[env:mkrvidor4000]
platform = atmelsam
framework = arduino
board = mkrvidor4000
[env:featheresp32]
platform = espressif32
framework = arduino
board = featheresp32
[env:nodemcu-32s]
platform = espressif32
framework = arduino
board = nodemcu-32s
// Multi-loops skeleton
// Description: Shows 3 loops operating in "parallel" reading/writing a global variable
// Karol Hennessy
// 2020-03-29
#include <VariableTimedAction.h>
// global variables
static int globalcnt = 0;
class SafetyAlarmLoop : public VariableTimedAction
{
private:
int cnt = 0;
unsigned long run()
{
cnt++;
Serial.println("SA "+ String(globalcnt));
return 0;
}
public:
int getCnt()
{
return cnt;
}
} safetyalarmloop ;
class BreathingLoop : public VariableTimedAction
{
private:
int cnt = 0;
unsigned long run()
{
cnt++;
Serial.println("BR "+ String(cnt));
return 0;
}
public:
int getCnt()
{
return cnt;
}
} breathingloop;
class UILoop : public VariableTimedAction
{
private:
//int cnt = 0;
unsigned long run()
{
globalcnt++;
Serial.println("UI "+ String(globalcnt));
return 0;
}
public:
/* int getCnt()
{
return cnt;
}*/
} uiloop;
void setup() {
Serial.begin(9600);
// note - order is not guaranteed if they all run on the same "cycle"
safetyalarmloop.start(1000);
//breathingloop.start(500);
uiloop.start(1000);
}
void loop() {
// put your main code here, to run repeatedly:
VariableTimedAction::updateActions();
}
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:uno]
platform = atmelavr
board = uno
framework = arduino
#include <Arduino.h>
// arduino uno
// pwm pins
const int pin_valve_in = 11;
const int pin_valve_out = 6;
const int pin_valve_scavenge = 5;
// adcs
const int pin_p_supply = A0;
const int pin_p_regulated = A1;
const int pin_p_buffer = A2;
const int pin_p_inhale = A3;
const int pin_p_exhale = A4;
// leds
const int pin_led_0 = 0;
const int pin_led_1 = 0;
const int pin_led_2 = 0;
// buzzer
const int pin_buzzer = 9;
void setup() {
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println("Breathing Only");
delay(5000);
// buzzer
// tone(pin, freq (Hz), duration);
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment