mmh seitdem ich das gemacht habe, wird vor eine Ausgabe im Terminal immer sowas gesetzt:
Externes Bild anzeigen
Ich habe das schon zurück verfolgt bis zur Konsoleneingabe. Die letzten Ausgaben stammen von dieser Eingabe:
Ich habe mal mit Hex-Term drüber geschaut. Das ist ein F8 was da zuviel gesendet wird. Aber in meinen Codes finde ich nichts in der Richtung.Code:echo >> /dev/ttyAMA0
UART.c
UART.phpCode:// Compile with: GCC /Programme/UART.c -o /Programme/UART //#include <iostream> //using namespace std; #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <termios.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #define BAUDRATE B115200 // Baudrate char MODEMDEVICE[]= "/dev/ttyAMA0"; // Device zum Senden struct termios newtio={}; // Variable für "termios.h" int fd; // File descriptor void Send_UART(char *c) // Gibt ein einzelnes Zeichen über UART (als fd geöffnet) aus. { int res; char LineEnd[] = "\r\n"; res = write(fd, c, strlen(c)); write(fd, LineEnd, 2); } int UART_Init() // Schnittstelle öffnen und parametrieren { // O_RDONLY, O_WRONLY or O_RDWR - // O_NDELAY (geht weiter, wenn keine Daten da sind und gibt "-1" zurueck) // man 2 open fuer mehr Infos - see "man 2 open" for more info // O_NOCTTY No ControllTeleType fd = open(MODEMDEVICE, O_WRONLY | O_NOCTTY); if (fd < 0) { printf("Fehler beim öffnen von %s\n", MODEMDEVICE); exit(-1); } memset(&newtio, 0, sizeof(newtio)); newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD; // Setzt die neuen Porteinstellungen newtio.c_iflag = IGNPAR; newtio.c_oflag = 0; newtio.c_lflag = 0; /* set input mode (non-canonical, no echo, ...) */ newtio.c_cc[VTIME] = 0; /* inter-character timer unused */ newtio.c_cc[VMIN] = 1; /* blocking read until 1 chars received */ tcflush(fd, TCIFLUSH); tcsetattr(fd, TCSANOW, &newtio); return fd; } int main(int argc, char** argv) // Programmstart { // Variablen für das Hauptprogramm char LineEnd[] = "\r\n"; int res; UART_Init(); // Schnittstelle öffnen und parametrieren if (argc >= 1) { res = write(fd, argv[1], strlen(argv[1])); write(fd, LineEnd, 2); } printf("Text empfangen\n"); // Empfangsbestätigung senden //Send_UART("Hallo"); close (fd); return 0; }
Weißt du evtl. was das sein könnte?Code:<html> <head> <title> Raspberry Pi Webserver </title> </head> <h1> <font color="red"> Raspberry Pi Webserver </font> </h1> <body> <div id="nav"><a href="index.php">Hauptseite</a> <h2> Raspberry Pi UART </h2> <?php if (isset($_POST["Eingabe"])) { $befehl="sudo /Programme/UART ".$_POST["Eingabe"]; $output = shell_exec($befehl); }; echo "<form method='post' action='UART.php'>"; echo "<input type='text' maxlength='40' size='40' id='1' name='Eingabe' value='Ich'>"; echo "<input type='submit' value='Senden'>"; echo "<br>"; echo "<br>"; echo "Antwort:"; echo "<br>"; echo "$output"; echo "</form>"; ?> </div> </body> </html>







Zitieren

Lesezeichen