Update
Took 10 minutes
This commit is contained in:
parent
cb72920611
commit
2fe26ef34b
8
arduino/itender/.theia/launch.json
Normal file
8
arduino/itender/.theia/launch.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
]
|
||||
}
|
0
arduino/itender/data/tare.ino
Normal file
0
arduino/itender/data/tare.ino
Normal file
@ -2,13 +2,25 @@
|
||||
* Official proxy code for iTender GPIO Communication
|
||||
**/
|
||||
|
||||
#include "HX711.h"
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
DynamicJsonDocument<200> doc;
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(9600);
|
||||
|
||||
while (!Serial) continue;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
if( Serial.available() > 0 )
|
||||
{
|
||||
String data = Serial.readString();
|
||||
|
||||
}
|
||||
}
|
||||
|
43
arduino/itender/tare.ino
Normal file
43
arduino/itender/tare.ino
Normal file
@ -0,0 +1,43 @@
|
||||
/**
|
||||
|
||||
#include "HX711.h"
|
||||
|
||||
const int LOADCELL_DOUT_PIN = 2;
|
||||
const int LOADCELL_SCK_PIN = 3;
|
||||
|
||||
HX711 scale;
|
||||
|
||||
int minus = 0;
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(9600);
|
||||
delay(1000);
|
||||
Serial.println("TARE");
|
||||
|
||||
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
|
||||
scale.set_scale(429.6159259259259);
|
||||
scale.tare();
|
||||
|
||||
delay(1000);
|
||||
minus=abs(scale.get_units(5));
|
||||
// scale.set_scale();
|
||||
// scale.tare();
|
||||
// Serial.println("TARE OK - PLACE WEIGHT");
|
||||
//delay(5000);
|
||||
}
|
||||
|
||||
int len = 0;
|
||||
long sum = 0;
|
||||
|
||||
void loop() {
|
||||
if (scale.is_ready()) {
|
||||
long data = scale.get_units(5) + minus;
|
||||
Serial.println(data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
**/
|
@ -58,6 +58,10 @@ sudo -u itender mkdir -p /home/itender/bin
|
||||
sudo -u itender sh -c 'curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=/home/itender/bin/ sh'
|
||||
sudo -u itender /home/itender/bin/arduino-cli config init
|
||||
sudo -u itender /home/itender/bin/arduino-cli core update-index || true
|
||||
sudo -u itender /home/itender/bin/arduino-cli lib search ArduinoJson || true
|
||||
sudo -u itender /home/itender/bin/arduino-cli lib install ArduinoJson || true
|
||||
|
||||
|
||||
|
||||
echo "Installing autostart..."
|
||||
# Autostart
|
||||
|
@ -4,30 +4,25 @@ import Ingredient from "./Ingredient";
|
||||
import Drink from "./Drink";
|
||||
import Container from "./Container";
|
||||
|
||||
// create a namespace for logging
|
||||
const log = debug("itender:server");
|
||||
|
||||
export class Database {
|
||||
// method to connect to the database
|
||||
public static connect(): Promise<void> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
//connect to mongodb using mongoose
|
||||
await Mongoose.connect("mongodb://127.0.0.1:27017/iTender?retryWrites=true");
|
||||
log("Connected to Database");
|
||||
/*if (Mongoose.connection.readyState == Mongoose.ConnectionStates.connected) {
|
||||
resolve();
|
||||
} else {
|
||||
reject("Can't connect to database");
|
||||
}*/
|
||||
|
||||
// Preload schemes
|
||||
// Preload the schema for Ingredient, Drink and Container
|
||||
Ingredient.find();
|
||||
Drink.find();
|
||||
Container.find();
|
||||
|
||||
resolve();
|
||||
} catch (e) {
|
||||
reject("Exception whilst connecting to Database " + e);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user