/[H7]/branches/linux-serial/serial1.cpp
ViewVC logotype

Diff of /branches/linux-serial/serial1.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 45 by torben, Sun Feb 4 21:22:44 2007 UTC revision 46 by torben, Sun Feb 4 23:11:02 2007 UTC
# Line 17  Line 17 
17  #include <iostream>  #include <iostream>
18  #include <iomanip>  #include <iomanip>
19  #include <exception>  #include <exception>
20    #include <stdexcept>
21    
22    
23  void my_pause()  void my_pause()
# Line 31  int main() Line 32  int main()
32  {  {
33          int count = 0;          int count = 0;
34          unsigned char c,input;          unsigned char c,input;
35          CH7Serial serial("com8", 9600);          CH7Serial serial;
36                    
37          try          try
38          {          {
39                    serial.open("/dev/ttyS0", 9600);
40                  // tænd lysdiode S3 / RB1                  // tænd lysdiode S3 / RB1
41                  std::cout << "--------------------------------------" << std::endl;                  std::cout << "--------------------------------------" << std::endl;
42                  serial.writeTarget(0,1);                  serial.writeTarget(0,1);
43                    /*
44                  Sleep(2000);                  Sleep(2000);
45    
46                  // sluk lysdiode S3 / RB1                  // sluk lysdiode S3 / RB1
# Line 70  int main() Line 73  int main()
73                  //aflæser potmeter igen ved 9600 bps                  //aflæser potmeter igen ved 9600 bps
74                  std::cout << "--------------------------------------" << std::endl;                  std::cout << "--------------------------------------" << std::endl;
75                  std::cout << "Potmeter: " << serial.readTarget(5) << std::endl;                  std::cout << "Potmeter: " << serial.readTarget(5) << std::endl;
76          } catch (std::exception e)                  */
77            }
78            catch (std::runtime_error& e)
79          {          {
80                  std::cout << "Exception :" << e.what() << std::endl;                  std::cout << "Error: " << e.what() << std::endl;
81                    exit(1);
82            }
83            catch (std::exception& e)
84            {
85                    std::cout << "Exception: " << e.what() << std::endl;
86                    exit(2);
87            }
88            catch(...)
89            {
90                    std::cout << "asd" << std::endl;
91                    exit(3);
92          }          }
93    
94          //std::cout << serial.readTarget(2) << std::endl;          //std::cout << serial.readTarget(2) << std::endl;

Legend:
Removed from v.45  
changed lines
  Added in v.46

  ViewVC Help
Powered by ViewVC 1.1.20