Fügt Controller hinzu

Signed-off-by: Christof Seyfferth <mail@seyfferth.dev>
This commit is contained in:
2020-09-03 12:48:58 +02:00
parent 39c9e31664
commit 1acb8ee516
8 changed files with 38 additions and 16 deletions

1
.theia/settings.json Normal file
View File

@@ -0,0 +1 @@
"sketch": "contact.ino"

4
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,4 @@
{
"python.linting.pylintEnabled": true,
"python.linting.enabled": true
}

7
controller.py Normal file
View File

@@ -0,0 +1,7 @@
import serial
ser = serial.Serial('/dev/ttyUSB0', 115200)
print(ser.name)
while 1:
line = ser.readline() # read a '\n' terminated line
print(line)

View File

@@ -0,0 +1,12 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
"version": "0.2.0",
"configurations": [
{
"name": "Arduino",
"type": "arduino",
"request": "launch"
}
]
}

View File

Binary file not shown.

View File

Binary file not shown.

View File

@@ -4,7 +4,6 @@
#include <MFRC522.h> #include <MFRC522.h>
#define SS_PIN 5 #define SS_PIN 5
#define RST_PIN 9//not used for esp32 #define RST_PIN 9//not used for esp32
byte readCard[4]; byte readCard[4];
MFRC522 mfrc522(SS_PIN, RST_PIN); MFRC522 mfrc522(SS_PIN, RST_PIN);
@@ -39,11 +38,10 @@ void setup() {
// Bring Up Wifi // Bring Up Wifi
WiFi.begin(ssid, password); WiFi.begin(ssid, password);
//while (WiFi.status() != WL_CONNECTED) { while (WiFi.status() != WL_CONNECTED) {
// delay(100); delay(100);
// Serial.print("."); Serial.print(".");
//} }
Serial.println(); Serial.println();
Serial.print("IP: "); Serial.print("IP: ");
Serial.println(WiFi.localIP()); Serial.println(WiFi.localIP());
@@ -53,19 +51,19 @@ void setup() {
mfrc522.PCD_Init(); mfrc522.PCD_Init();
// Piep // Piep
ledcSetup(channel, freq, resolution); // ledcSetup(channel, freq, resolution);
ledcAttachPin(27, channel); // ledcAttachPin(27, channel);
for (int i = 0; i<20000; i=i+100){ // for (int i = 0; i<20000; i=i+100){
ledcWriteTone(channel, i); // ledcWriteTone(channel, i);
Serial.println(i); // Serial.println(i);
delay(200); // delay(200);
} // }
} }
void loop() { void loop() {
//if(WiFi.status()== WL_CONNECTED){ if(WiFi.status()== WL_CONNECTED){
if ( ! mfrc522.PICC_IsNewCardPresent()) { if ( ! mfrc522.PICC_IsNewCardPresent()) {
return; return;
} }
@@ -79,8 +77,8 @@ void loop() {
Serial.print(readCard[i], HEX); Serial.print(readCard[i], HEX);
CardID=CardID+String(readCard[i], HEX); CardID=CardID+String(readCard[i], HEX);
} }
//sendData(CardID); sendData(CardID);
Serial.println(""); Serial.println("");
mfrc522.PICC_HaltA(); mfrc522.PICC_HaltA();
//} }
} }