Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
#include
#include
#include
//this code sends characters to the arduino and RoboKun listens.. int main() { int arduino = open("/dev/ttyACM0", O_RDWR | O_NOCTTY | O_NDELAY); if (arduino == -1) { perror("Is the Arduino Connected?"); return 1; } struct termios options; tcgetattr(arduino, &options); cfsetispeed(&options, B9600); cfsetospeed(&options, B9600); options.c_cflag |= (CLOCAL | CREAD); tcsetattr(arduino, TCSANOW, &options); char w='w'; char a='a'; char s='s'; char d='d'; char b='b'; int dtime=5; char keystrokes[] = "b"; keystrokes[0]=w; printf("Forward\n"); write(arduino, keystrokes, strlen(keystrokes)); sleep(dtime); keystrokes[0] = d; printf("Right\n"); write(arduino, keystrokes, strlen(keystrokes)); sleep(dtime); keystrokes[0] = a; printf("LEft\n"); write(arduino, keystrokes, strlen(keystrokes)); sleep(dtime); keystrokes[0] = s; printf("Reverse\n"); write(arduino, keystrokes, strlen(keystrokes)); sleep(dtime); keystrokes[0] = b; printf("halt\n"); write(arduino, keystrokes, strlen(keystrokes)); sleep(1); close(arduino); return 0; }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)