KettlerBikeComm.cs 731 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO.Ports;
  7. namespace Fietsclient
  8. {
  9. class KettlerBikeComm
  10. {
  11. private string _portname;
  12. private int baudrate = 9600;
  13. private SerialPort ComPort;
  14. public KettlerBikeComm(string port)
  15. {
  16. this._portname = port;
  17. }
  18. public void initComm()
  19. {
  20. ComPort = new SerialPort(_portname, this.baudrate);
  21. ComPort.Open();
  22. Console.WriteLine("test");
  23. ComPort.WriteLine("RS");
  24. Console.Write(ComPort.ReadLine());
  25. Console.WriteLine("end of message");
  26. }
  27. }
  28. }