Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Arduino source code:
- void setup () {
- Serial.begin(9600);
- }
- void loop () {
- Serial.print("$$$");
- delay(2000); // TODO: Inquiry, etc.
- Serial.print("---n");
- delay(100);
- Serial.print("pingn");
- delay(2000);
- }
- // C# source code (runs on PC)
- using System;
- using System.IO.Ports;
- class Program {
- static void Main () {
- SerialPort p = new SerialPort(
- "COM20", 9600, Parity.None, 8, StopBits.One);
- using (p) {
- p.Open();
- while (p.IsOpen) {
- Console.Write((char) p.ReadChar());
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment