Arduino-Datei:
(zu Testzwecken verwende ich ein Potentiometer)
Ich versuche, alles durch Kommas getrennt zu halten.
Code: Select all
void setup() {
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int A0Value = analogRead(A1);
int A1Value = analogRead(A1);
int A2Value = analogRead(A1);
int A3Value = analogRead(A1);
int A4Value = analogRead(A1);
int A5Value = analogRead(A1);
String message = "A0," + String(A0Value) + ","
"A1," + String(A1Value) +","
"A2," + String(A2Value) +","
"A3," + String(A3Value) +","
"A4," + String(A4Value) +","
"A5," + String(A5Value) + "\n";
//print out the value you read in the Serial Monitor:
Serial.print(message);
delay(1);
}
Code: Select all
//#include "serialCommunication.h"
#include
#include
#include
#include
#include
#include
int main(){
// Serial Port Initialization
HANDLE hComm;
hComm = CreateFileW(L"\\\\.\\COM6", //port name
GENERIC_READ | GENERIC_WRITE, //Read/Write
0, // No Sharing
NULL, // No Security
OPEN_EXISTING, // Open existing port only
0, // Non Overlapped I/O
NULL); // Null for Comm Devices
if (hComm == INVALID_HANDLE_VALUE) {
if (GetLastError() == ERROR_FILE_NOT_FOUND) {
std::cerr
Mobile version