Guest User

Untitled

a guest
Jun 24th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 62.01 KB | None | 0 0
  1. #undef UNICODE
  2.  
  3. #define WIN32_LEAN_AND_MEAN
  4.  
  5. #include "stdafx.h"
  6. #include <iostream>
  7. #include <string>
  8. #include <sstream>
  9. #include <fstream>
  10. #include <math.h>
  11.  
  12.  
  13. #include <winsock2.h>
  14. #include <ws2tcpip.h>
  15. #include <stdlib.h>
  16. #include <stdio.h>
  17. #include <iostream>
  18. using namespace System;
  19. using namespace System::IO::Ports;
  20. using namespace System::Threading;
  21.  
  22. #pragma comment (lib, "Ws2_32.lib")
  23. #pragma once
  24.  
  25. #define DEFAULT_BUFLEN 32
  26. #define DEFAULT_PORT "27015"
  27.  
  28.  
  29. namespace SWIMIRGUI {
  30.  
  31. using namespace System;
  32. using namespace System::ComponentModel;
  33. using namespace System::Collections;
  34. using namespace System::Windows::Forms;
  35. using namespace System::Data;
  36. using namespace System::Drawing;
  37.  
  38. static char publicDataToReceive[32];
  39. static char publicDataToSend[32];
  40. static char sendToLogCA[32];
  41. static int threadReadyToSend;
  42. static int threadReadyToReceive;
  43. static int threadDone;
  44.  
  45. public ref class ThreadExample
  46. {
  47. public:
  48.  
  49. static void ThreadProc()
  50. {
  51. WSADATA wsaData;
  52. int iResult;
  53.  
  54. SOCKET ListenSocket = INVALID_SOCKET;
  55. SOCKET ClientSocket = INVALID_SOCKET;
  56.  
  57. struct addrinfo *result = NULL;
  58. struct addrinfo hints;
  59.  
  60. int iSendResult;
  61. char recvbuf[DEFAULT_BUFLEN];
  62. int recvbuflen = DEFAULT_BUFLEN;
  63.  
  64. // Initialize Winsock
  65. iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
  66. if (iResult != 0) {
  67. }
  68.  
  69. ZeroMemory(&hints, sizeof(hints));
  70. hints.ai_family = AF_INET;
  71. hints.ai_socktype = SOCK_STREAM;
  72. hints.ai_protocol = IPPROTO_TCP;
  73. hints.ai_flags = AI_PASSIVE;
  74.  
  75. // Resolve the server address and port
  76. iResult = getaddrinfo(NULL, DEFAULT_PORT, &hints, &result);
  77. if ( iResult != 0 ) {
  78. WSACleanup();
  79. }
  80.  
  81. // Create a SOCKET for connecting to server
  82. ListenSocket = socket(result->ai_family, result->ai_socktype, result->ai_protocol);
  83. if (ListenSocket == INVALID_SOCKET) {
  84. freeaddrinfo(result);
  85. WSACleanup();
  86. }
  87.  
  88. // Setup the TCP listening socket
  89. iResult = bind( ListenSocket, result->ai_addr, (int)result->ai_addrlen);
  90. if (iResult == SOCKET_ERROR) {
  91. freeaddrinfo(result);
  92. closesocket(ListenSocket);
  93. WSACleanup();
  94. }
  95.  
  96. freeaddrinfo(result);
  97.  
  98. iResult = listen(ListenSocket, SOMAXCONN);
  99. if (iResult == SOCKET_ERROR) {
  100. closesocket(ListenSocket);
  101. WSACleanup();
  102. }
  103.  
  104. // Accept a client socket
  105. ClientSocket = accept(ListenSocket, NULL, NULL);
  106. if (ClientSocket == INVALID_SOCKET) {
  107. closesocket(ListenSocket);
  108. WSACleanup();
  109. }
  110.  
  111. // No longer need server socket
  112. closesocket(ListenSocket);
  113.  
  114. // Receive until the peer shuts down the connection
  115. do {
  116. //iResult = recv(ClientSocket, recvbuf, recvbuflen, 0);
  117. //if (iResult > 0) {
  118. // printf(">>%s\n",recvbuf);
  119. // for(int k=0; k<32; k++){
  120. // publicDataToReceive[k] = E;
  121. // }
  122.  
  123. // for(int k=0; k<32; k++){
  124. // publicDataToReceive[k] = recvbuf[k];
  125. // }
  126. //}
  127.  
  128. Sleep(1000);
  129. strcpy_s(publicDataToSend,"samplemessage");//Probably delete when I have actual data going into publicDataToSend
  130. strcpy_s(sendToLogCA, publicDataToSend);
  131. iSendResult = send( ClientSocket, publicDataToSend, (int)strlen(publicDataToSend), 0 );
  132. if (iSendResult == SOCKET_ERROR) {
  133. closesocket(ClientSocket);
  134. WSACleanup();
  135. }
  136. } while(1);
  137.  
  138. // shutdown the connection since we're done
  139. iResult = shutdown(ClientSocket, SD_SEND);
  140. if (iResult == SOCKET_ERROR) {
  141. closesocket(ClientSocket);
  142. WSACleanup();
  143. }
  144.  
  145. // cleanup
  146. closesocket(ClientSocket);
  147. WSACleanup();
  148.  
  149. // Yield the rest of the time slice.
  150. Thread::Sleep( 0 );
  151. }
  152. };
  153.  
  154. /// <summary>
  155. /// Summary for Form1
  156. /// </summary>
  157. public ref class Form1 : public System::Windows::Forms::Form
  158. {
  159. public:
  160. SerialPort^ comPort;
  161. Form1(void)
  162. {
  163. InitializeComponent();
  164. //
  165. //TODO: Add the constructor code here
  166. //
  167. }
  168.  
  169.  
  170. protected:
  171. /// <summary>
  172. /// Clean up any resources being used.
  173. /// </summary>
  174. ~Form1()
  175. {
  176. if (components)
  177. {
  178. delete components;
  179. }
  180. }
  181.  
  182. private: System::Windows::Forms::TextBox^ receivedLog;
  183.  
  184.  
  185. private: System::Windows::Forms::TextBox^ sentLog;
  186.  
  187. private: System::Windows::Forms::Label^ label1;
  188. private: System::Windows::Forms::TextBox^ lastCommand;
  189.  
  190. private: System::Windows::Forms::Label^ label2;
  191. private: System::Windows::Forms::Label^ label3;
  192. private: System::Windows::Forms::TextBox^ textBox1;
  193. private: System::Windows::Forms::TextBox^ textBox2;
  194. private: System::Windows::Forms::TextBox^ textBox3;
  195. private: System::Windows::Forms::TextBox^ textBox4;
  196.  
  197. private: System::Windows::Forms::Label^ label5;
  198. private: System::Windows::Forms::Label^ label6;
  199. private: System::Windows::Forms::Label^ label7;
  200.  
  201.  
  202.  
  203. private: System::Windows::Forms::Label^ label9;
  204.  
  205. private: System::Windows::Forms::TrackBar^ trackBar1;
  206. private: System::Windows::Forms::TrackBar^ trackBar2;
  207. private: System::Windows::Forms::TrackBar^ trackBar3;
  208. private: System::Windows::Forms::TrackBar^ trackBar4;
  209. private: System::Windows::Forms::TextBox^ textBox5;
  210. private: System::Windows::Forms::Label^ label8;
  211. private: System::Windows::Forms::GroupBox^ groupBox1;
  212. private: System::Windows::Forms::Label^ label4;
  213. private: System::Windows::Forms::TextBox^ lastReceived;
  214.  
  215. private: System::Windows::Forms::Button^ lightToggle;
  216.  
  217. private: System::Windows::Forms::Label^ label19;
  218. private: System::Windows::Forms::Label^ label18;
  219. private: System::Windows::Forms::Label^ label17;
  220. private: System::Windows::Forms::Label^ label14;
  221. private: System::Windows::Forms::Label^ label15;
  222. private: System::Windows::Forms::Label^ label16;
  223. private: System::Windows::Forms::Label^ label13;
  224. private: System::Windows::Forms::Label^ label12;
  225. private: System::Windows::Forms::Label^ label11;
  226. private: System::Windows::Forms::Label^ label20;
  227. private: System::Windows::Forms::Label^ label21;
  228. private: System::Windows::Forms::Label^ label22;
  229. private: System::Windows::Forms::GroupBox^ groupBox3;
  230. private: System::Windows::Forms::GroupBox^ groupBox2;
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245. private: System::Windows::Forms::GroupBox^ groupBox6;
  246. private: System::Windows::Forms::Button^ button1;
  247. private: System::Windows::Forms::GroupBox^ groupBox4;
  248. private: System::Windows::Forms::Label^ label30;
  249. private: System::Windows::Forms::Label^ label29;
  250. private: System::Windows::Forms::Label^ label28;
  251. private: System::Windows::Forms::Label^ label27;
  252. private: System::Windows::Forms::Label^ label26;
  253. private: System::Windows::Forms::Label^ label25;
  254. private: System::Windows::Forms::Label^ label24;
  255. private: System::Windows::Forms::Label^ label23;
  256.  
  257. private: System::Windows::Forms::MenuStrip^ menuStrip1;
  258. private: System::Windows::Forms::ToolStripMenuItem^ fileToolStripMenuItem;
  259. private: System::Windows::Forms::ToolStripMenuItem^ exitToolStripMenuItem;
  260. private: System::Windows::Forms::ToolStripMenuItem^ editToolStripMenuItem;
  261. private: System::Windows::Forms::ToolStripMenuItem^ resetToolStripMenuItem;
  262. private: System::Windows::Forms::ToolStripMenuItem^ viewToolStripMenuItem;
  263. private: System::Windows::Forms::ToolStripMenuItem^ onlineHelpToolStripMenuItem;
  264. private: System::Windows::Forms::TrackBar^ trackBar5;
  265. private: System::Windows::Forms::GroupBox^ groupBox5;
  266. private: System::Windows::Forms::Label^ label34;
  267. private: System::Windows::Forms::Label^ label33;
  268. private: System::Windows::Forms::Label^ label32;
  269. private: System::Windows::Forms::Label^ label31;
  270. private: System::Windows::Forms::TabControl^ tabControl1;
  271. private: System::Windows::Forms::TabPage^ tabPage1;
  272. private: System::Windows::Forms::TabPage^ tabPage2;
  273. private: System::Windows::Forms::Button^ getSensor;
  274. private: System::Windows::Forms::Button^ getBattery;
  275. private: System::Windows::Forms::Button^ surface;
  276. private: System::Windows::Forms::GroupBox^ groupBox7;
  277. private: System::Windows::Forms::Button^ sServoPlus;
  278.  
  279. private: System::Windows::Forms::Label^ label35;
  280. private: System::Windows::Forms::Button^ bServoPlus;
  281.  
  282. private: System::Windows::Forms::Label^ label10;
  283. private: System::Windows::Forms::Button^ bServoMinus;
  284. private: System::Windows::Forms::Button^ sServoMinus;
  285. private: System::Windows::Forms::Button^ hardwareOff;
  286. private: System::Windows::Forms::RadioButton^ radioButton1;
  287. private: System::Windows::Forms::TextBox^ textBox7;
  288. private: System::Windows::Forms::TextBox^ textBox6;
  289.  
  290.  
  291.  
  292.  
  293.  
  294. protected:
  295.  
  296. private:
  297. /// <summary>
  298. /// Required designer variable.
  299. /// </summary>
  300. System::ComponentModel::Container ^components;
  301.  
  302. #pragma region Windows Form Designer generated code
  303. /// <summary>
  304. /// Required method for Designer support - do not modify
  305. /// the contents of this method with the code editor.
  306. /// </summary>
  307. void InitializeComponent(void)
  308. {
  309. this->receivedLog = (gcnew System::Windows::Forms::TextBox());
  310. this->sentLog = (gcnew System::Windows::Forms::TextBox());
  311. this->label1 = (gcnew System::Windows::Forms::Label());
  312. this->lastCommand = (gcnew System::Windows::Forms::TextBox());
  313. this->label2 = (gcnew System::Windows::Forms::Label());
  314. this->label3 = (gcnew System::Windows::Forms::Label());
  315. this->textBox1 = (gcnew System::Windows::Forms::TextBox());
  316. this->textBox2 = (gcnew System::Windows::Forms::TextBox());
  317. this->textBox3 = (gcnew System::Windows::Forms::TextBox());
  318. this->textBox4 = (gcnew System::Windows::Forms::TextBox());
  319. this->label5 = (gcnew System::Windows::Forms::Label());
  320. this->label6 = (gcnew System::Windows::Forms::Label());
  321. this->label7 = (gcnew System::Windows::Forms::Label());
  322. this->label9 = (gcnew System::Windows::Forms::Label());
  323. this->trackBar1 = (gcnew System::Windows::Forms::TrackBar());
  324. this->trackBar2 = (gcnew System::Windows::Forms::TrackBar());
  325. this->trackBar3 = (gcnew System::Windows::Forms::TrackBar());
  326. this->trackBar4 = (gcnew System::Windows::Forms::TrackBar());
  327. this->textBox5 = (gcnew System::Windows::Forms::TextBox());
  328. this->label8 = (gcnew System::Windows::Forms::Label());
  329. this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
  330. this->groupBox3 = (gcnew System::Windows::Forms::GroupBox());
  331. this->label19 = (gcnew System::Windows::Forms::Label());
  332. this->label18 = (gcnew System::Windows::Forms::Label());
  333. this->label17 = (gcnew System::Windows::Forms::Label());
  334. this->label13 = (gcnew System::Windows::Forms::Label());
  335. this->label12 = (gcnew System::Windows::Forms::Label());
  336. this->label11 = (gcnew System::Windows::Forms::Label());
  337. this->groupBox2 = (gcnew System::Windows::Forms::GroupBox());
  338. this->label21 = (gcnew System::Windows::Forms::Label());
  339. this->label20 = (gcnew System::Windows::Forms::Label());
  340. this->label22 = (gcnew System::Windows::Forms::Label());
  341. this->label14 = (gcnew System::Windows::Forms::Label());
  342. this->label15 = (gcnew System::Windows::Forms::Label());
  343. this->label16 = (gcnew System::Windows::Forms::Label());
  344. this->label4 = (gcnew System::Windows::Forms::Label());
  345. this->lastReceived = (gcnew System::Windows::Forms::TextBox());
  346. this->lightToggle = (gcnew System::Windows::Forms::Button());
  347. this->groupBox6 = (gcnew System::Windows::Forms::GroupBox());
  348. this->button1 = (gcnew System::Windows::Forms::Button());
  349. this->groupBox4 = (gcnew System::Windows::Forms::GroupBox());
  350. this->label30 = (gcnew System::Windows::Forms::Label());
  351. this->label29 = (gcnew System::Windows::Forms::Label());
  352. this->label28 = (gcnew System::Windows::Forms::Label());
  353. this->label27 = (gcnew System::Windows::Forms::Label());
  354. this->label26 = (gcnew System::Windows::Forms::Label());
  355. this->label25 = (gcnew System::Windows::Forms::Label());
  356. this->label24 = (gcnew System::Windows::Forms::Label());
  357. this->label23 = (gcnew System::Windows::Forms::Label());
  358. this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
  359. this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  360. this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  361. this->editToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  362. this->resetToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  363. this->viewToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  364. this->onlineHelpToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
  365. this->trackBar5 = (gcnew System::Windows::Forms::TrackBar());
  366. this->groupBox5 = (gcnew System::Windows::Forms::GroupBox());
  367. this->label34 = (gcnew System::Windows::Forms::Label());
  368. this->label33 = (gcnew System::Windows::Forms::Label());
  369. this->label32 = (gcnew System::Windows::Forms::Label());
  370. this->label31 = (gcnew System::Windows::Forms::Label());
  371. this->tabControl1 = (gcnew System::Windows::Forms::TabControl());
  372. this->tabPage1 = (gcnew System::Windows::Forms::TabPage());
  373. this->radioButton1 = (gcnew System::Windows::Forms::RadioButton());
  374. this->hardwareOff = (gcnew System::Windows::Forms::Button());
  375. this->surface = (gcnew System::Windows::Forms::Button());
  376. this->getSensor = (gcnew System::Windows::Forms::Button());
  377. this->getBattery = (gcnew System::Windows::Forms::Button());
  378. this->tabPage2 = (gcnew System::Windows::Forms::TabPage());
  379. this->groupBox7 = (gcnew System::Windows::Forms::GroupBox());
  380. this->sServoPlus = (gcnew System::Windows::Forms::Button());
  381. this->label35 = (gcnew System::Windows::Forms::Label());
  382. this->bServoPlus = (gcnew System::Windows::Forms::Button());
  383. this->label10 = (gcnew System::Windows::Forms::Label());
  384. this->bServoMinus = (gcnew System::Windows::Forms::Button());
  385. this->sServoMinus = (gcnew System::Windows::Forms::Button());
  386. this->textBox6 = (gcnew System::Windows::Forms::TextBox());
  387. this->textBox7 = (gcnew System::Windows::Forms::TextBox());
  388. (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->trackBar1))->BeginInit();
  389. (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->trackBar2))->BeginInit();
  390. (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->trackBar3))->BeginInit();
  391. (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->trackBar4))->BeginInit();
  392. this->groupBox1->SuspendLayout();
  393. this->groupBox3->SuspendLayout();
  394. this->groupBox2->SuspendLayout();
  395. this->groupBox6->SuspendLayout();
  396. this->groupBox4->SuspendLayout();
  397. this->menuStrip1->SuspendLayout();
  398. (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->trackBar5))->BeginInit();
  399. this->groupBox5->SuspendLayout();
  400. this->tabControl1->SuspendLayout();
  401. this->tabPage1->SuspendLayout();
  402. this->tabPage2->SuspendLayout();
  403. this->groupBox7->SuspendLayout();
  404. this->SuspendLayout();
  405. //
  406. // receivedLog
  407. //
  408. this->receivedLog->Location = System::Drawing::Point(307, 113);
  409. this->receivedLog->Multiline = true;
  410. this->receivedLog->Name = L"receivedLog";
  411. this->receivedLog->ReadOnly = true;
  412. this->receivedLog->ScrollBars = System::Windows::Forms::ScrollBars::Vertical;
  413. this->receivedLog->Size = System::Drawing::Size(271, 144);
  414. this->receivedLog->TabIndex = 1;
  415. //
  416. // sentLog
  417. //
  418. this->sentLog->Location = System::Drawing::Point(18, 111);
  419. this->sentLog->Multiline = true;
  420. this->sentLog->Name = L"sentLog";
  421. this->sentLog->ReadOnly = true;
  422. this->sentLog->ScrollBars = System::Windows::Forms::ScrollBars::Vertical;
  423. this->sentLog->Size = System::Drawing::Size(268, 144);
  424. this->sentLog->TabIndex = 3;
  425. //
  426. // label1
  427. //
  428. this->label1->AutoSize = true;
  429. this->label1->Location = System::Drawing::Point(15, 95);
  430. this->label1->Name = L"label1";
  431. this->label1->Size = System::Drawing::Size(100, 13);
  432. this->label1->TabIndex = 4;
  433. this->label1->Text = L"Sent Command Log";
  434. //
  435. // lastCommand
  436. //
  437. this->lastCommand->Location = System::Drawing::Point(136, 43);
  438. this->lastCommand->Name = L"lastCommand";
  439. this->lastCommand->ReadOnly = true;
  440. this->lastCommand->Size = System::Drawing::Size(352, 20);
  441. this->lastCommand->TabIndex = 5;
  442. //
  443. // label2
  444. //
  445. this->label2->AutoSize = true;
  446. this->label2->Location = System::Drawing::Point(31, 46);
  447. this->label2->Name = L"label2";
  448. this->label2->Size = System::Drawing::Size(102, 13);
  449. this->label2->TabIndex = 6;
  450. this->label2->Text = L"Last Command Sent";
  451. //
  452. // label3
  453. //
  454. this->label3->AutoSize = true;
  455. this->label3->Location = System::Drawing::Point(304, 97);
  456. this->label3->Name = L"label3";
  457. this->label3->Size = System::Drawing::Size(105, 13);
  458. this->label3->TabIndex = 7;
  459. this->label3->Text = L"Micro Feedback Log";
  460. //
  461. // textBox1
  462. //
  463. this->textBox1->Location = System::Drawing::Point(69, 218);
  464. this->textBox1->Name = L"textBox1";
  465. this->textBox1->ReadOnly = true;
  466. this->textBox1->Size = System::Drawing::Size(41, 20);
  467. this->textBox1->TabIndex = 8;
  468. //
  469. // textBox2
  470. //
  471. this->textBox2->Location = System::Drawing::Point(25, 60);
  472. this->textBox2->Name = L"textBox2";
  473. this->textBox2->ReadOnly = true;
  474. this->textBox2->Size = System::Drawing::Size(41, 20);
  475. this->textBox2->TabIndex = 9;
  476. //
  477. // textBox3
  478. //
  479. this->textBox3->Location = System::Drawing::Point(73, 215);
  480. this->textBox3->Name = L"textBox3";
  481. this->textBox3->ReadOnly = true;
  482. this->textBox3->Size = System::Drawing::Size(41, 20);
  483. this->textBox3->TabIndex = 10;
  484. //
  485. // textBox4
  486. //
  487. this->textBox4->Location = System::Drawing::Point(28, 58);
  488. this->textBox4->Name = L"textBox4";
  489. this->textBox4->ReadOnly = true;
  490. this->textBox4->Size = System::Drawing::Size(41, 20);
  491. this->textBox4->TabIndex = 11;
  492. //
  493. // label5
  494. //
  495. this->label5->AutoSize = true;
  496. this->label5->Location = System::Drawing::Point(5, 63);
  497. this->label5->Name = L"label5";
  498. this->label5->Size = System::Drawing::Size(14, 13);
  499. this->label5->TabIndex = 14;
  500. this->label5->Text = L"Y";
  501. //
  502. // label6
  503. //
  504. this->label6->AutoSize = true;
  505. this->label6->Location = System::Drawing::Point(53, 219);
  506. this->label6->Name = L"label6";
  507. this->label6->Size = System::Drawing::Size(14, 13);
  508. this->label6->TabIndex = 15;
  509. this->label6->Text = L"Z";
  510. //
  511. // label7
  512. //
  513. this->label7->AutoSize = true;
  514. this->label7->Location = System::Drawing::Point(7, 59);
  515. this->label7->Name = L"label7";
  516. this->label7->Size = System::Drawing::Size(15, 13);
  517. this->label7->TabIndex = 16;
  518. this->label7->Text = L"R";
  519. //
  520. // label9
  521. //
  522. this->label9->AutoSize = true;
  523. this->label9->Location = System::Drawing::Point(49, 220);
  524. this->label9->Name = L"label9";
  525. this->label9->Size = System::Drawing::Size(14, 13);
  526. this->label9->TabIndex = 18;
  527. this->label9->Text = L"X";
  528. //
  529. // trackBar1
  530. //
  531. this->trackBar1->Location = System::Drawing::Point(8, 163);
  532. this->trackBar1->Maximum = 100;
  533. this->trackBar1->Name = L"trackBar1";
  534. this->trackBar1->Size = System::Drawing::Size(143, 45);
  535. this->trackBar1->TabIndex = 20;
  536. this->trackBar1->TickFrequency = 50;
  537. //
  538. // trackBar2
  539. //
  540. this->trackBar2->Location = System::Drawing::Point(72, 14);
  541. this->trackBar2->Maximum = 100;
  542. this->trackBar2->Name = L"trackBar2";
  543. this->trackBar2->Orientation = System::Windows::Forms::Orientation::Vertical;
  544. this->trackBar2->Size = System::Drawing::Size(45, 143);
  545. this->trackBar2->TabIndex = 21;
  546. this->trackBar2->TickFrequency = 50;
  547. //
  548. // trackBar3
  549. //
  550. this->trackBar3->Location = System::Drawing::Point(10, 161);
  551. this->trackBar3->Maximum = 100;
  552. this->trackBar3->Name = L"trackBar3";
  553. this->trackBar3->Size = System::Drawing::Size(143, 45);
  554. this->trackBar3->TabIndex = 22;
  555. this->trackBar3->TickFrequency = 50;
  556. //
  557. // trackBar4
  558. //
  559. this->trackBar4->Location = System::Drawing::Point(73, 13);
  560. this->trackBar4->Maximum = 100;
  561. this->trackBar4->Name = L"trackBar4";
  562. this->trackBar4->Orientation = System::Windows::Forms::Orientation::Vertical;
  563. this->trackBar4->Size = System::Drawing::Size(45, 143);
  564. this->trackBar4->TabIndex = 23;
  565. this->trackBar4->TickFrequency = 50;
  566. //
  567. // textBox5
  568. //
  569. this->textBox5->Location = System::Drawing::Point(9, 305);
  570. this->textBox5->Name = L"textBox5";
  571. this->textBox5->ReadOnly = true;
  572. this->textBox5->Size = System::Drawing::Size(76, 20);
  573. this->textBox5->TabIndex = 12;
  574. this->textBox5->TextChanged += gcnew System::EventHandler(this, &Form1::textBox5_TextChanged);
  575. //
  576. // label8
  577. //
  578. this->label8->AutoSize = true;
  579. this->label8->Location = System::Drawing::Point(6, 289);
  580. this->label8->Name = L"label8";
  581. this->label8->Size = System::Drawing::Size(79, 13);
  582. this->label8->TabIndex = 17;
  583. this->label8->Text = L"Button Pressed";
  584. //
  585. // groupBox1
  586. //
  587. this->groupBox1->Controls->Add(this->groupBox3);
  588. this->groupBox1->Controls->Add(this->groupBox2);
  589. this->groupBox1->Controls->Add(this->label8);
  590. this->groupBox1->Controls->Add(this->textBox5);
  591. this->groupBox1->Location = System::Drawing::Point(605, 14);
  592. this->groupBox1->Name = L"groupBox1";
  593. this->groupBox1->Size = System::Drawing::Size(373, 334);
  594. this->groupBox1->TabIndex = 24;
  595. this->groupBox1->TabStop = false;
  596. this->groupBox1->Text = L"Controls";
  597. //
  598. // groupBox3
  599. //
  600. this->groupBox3->Controls->Add(this->label19);
  601. this->groupBox3->Controls->Add(this->label18);
  602. this->groupBox3->Controls->Add(this->label17);
  603. this->groupBox3->Controls->Add(this->label13);
  604. this->groupBox3->Controls->Add(this->label12);
  605. this->groupBox3->Controls->Add(this->label11);
  606. this->groupBox3->Controls->Add(this->label9);
  607. this->groupBox3->Controls->Add(this->label5);
  608. this->groupBox3->Controls->Add(this->trackBar2);
  609. this->groupBox3->Controls->Add(this->textBox2);
  610. this->groupBox3->Controls->Add(this->trackBar1);
  611. this->groupBox3->Controls->Add(this->textBox1);
  612. this->groupBox3->Location = System::Drawing::Point(9, 19);
  613. this->groupBox3->Name = L"groupBox3";
  614. this->groupBox3->Size = System::Drawing::Size(176, 255);
  615. this->groupBox3->TabIndex = 37;
  616. this->groupBox3->TabStop = false;
  617. this->groupBox3->Text = L"Analog1";
  618. //
  619. // label19
  620. //
  621. this->label19->AutoSize = true;
  622. this->label19->Location = System::Drawing::Point(118, 195);
  623. this->label19->Name = L"label19";
  624. this->label19->Size = System::Drawing::Size(32, 13);
  625. this->label19->TabIndex = 32;
  626. this->label19->Text = L"Tilt R";
  627. //
  628. // label18
  629. //
  630. this->label18->AutoSize = true;
  631. this->label18->Location = System::Drawing::Point(66, 195);
  632. this->label18->Name = L"label18";
  633. this->label18->Size = System::Drawing::Size(33, 13);
  634. this->label18->TabIndex = 31;
  635. this->label18->Text = L"Level";
  636. //
  637. // label17
  638. //
  639. this->label17->AutoSize = true;
  640. this->label17->Location = System::Drawing::Point(5, 195);
  641. this->label17->Name = L"label17";
  642. this->label17->Size = System::Drawing::Size(30, 13);
  643. this->label17->TabIndex = 30;
  644. this->label17->Text = L"Tilt L";
  645. //
  646. // label13
  647. //
  648. this->label13->AutoSize = true;
  649. this->label13->Location = System::Drawing::Point(108, 144);
  650. this->label13->Name = L"label13";
  651. this->label13->Size = System::Drawing::Size(31, 13);
  652. this->label13->TabIndex = 26;
  653. this->label13->Text = L"Tilt B";
  654. //
  655. // label12
  656. //
  657. this->label12->AutoSize = true;
  658. this->label12->Location = System::Drawing::Point(108, 81);
  659. this->label12->Name = L"label12";
  660. this->label12->Size = System::Drawing::Size(33, 13);
  661. this->label12->TabIndex = 25;
  662. this->label12->Text = L"Level";
  663. //
  664. // label11
  665. //
  666. this->label11->AutoSize = true;
  667. this->label11->Location = System::Drawing::Point(108, 14);
  668. this->label11->Name = L"label11";
  669. this->label11->Size = System::Drawing::Size(30, 13);
  670. this->label11->TabIndex = 24;
  671. this->label11->Text = L"Tilt F";
  672. //
  673. // groupBox2
  674. //
  675. this->groupBox2->Controls->Add(this->label21);
  676. this->groupBox2->Controls->Add(this->label20);
  677. this->groupBox2->Controls->Add(this->label22);
  678. this->groupBox2->Controls->Add(this->label14);
  679. this->groupBox2->Controls->Add(this->label15);
  680. this->groupBox2->Controls->Add(this->label16);
  681. this->groupBox2->Controls->Add(this->label7);
  682. this->groupBox2->Controls->Add(this->textBox4);
  683. this->groupBox2->Controls->Add(this->label6);
  684. this->groupBox2->Controls->Add(this->trackBar3);
  685. this->groupBox2->Controls->Add(this->textBox3);
  686. this->groupBox2->Controls->Add(this->trackBar4);
  687. this->groupBox2->Location = System::Drawing::Point(191, 21);
  688. this->groupBox2->Name = L"groupBox2";
  689. this->groupBox2->Size = System::Drawing::Size(173, 255);
  690. this->groupBox2->TabIndex = 36;
  691. this->groupBox2->TabStop = false;
  692. this->groupBox2->Text = L"Analog2";
  693. //
  694. // label21
  695. //
  696. this->label21->Anchor = System::Windows::Forms::AnchorStyles::None;
  697. this->label21->AutoSize = true;
  698. this->label21->Location = System::Drawing::Point(70, 193);
  699. this->label21->Name = L"label21";
  700. this->label21->Size = System::Drawing::Size(43, 13);
  701. this->label21->TabIndex = 34;
  702. this->label21->Text = L"Straight";
  703. this->label21->TextAlign = System::Drawing::ContentAlignment::TopCenter;
  704. //
  705. // label20
  706. //
  707. this->label20->AutoSize = true;
  708. this->label20->Location = System::Drawing::Point(124, 193);
  709. this->label20->Name = L"label20";
  710. this->label20->Size = System::Drawing::Size(40, 13);
  711. this->label20->TabIndex = 35;
  712. this->label20->Text = L"Turn R";
  713. //
  714. // label22
  715. //
  716. this->label22->AutoSize = true;
  717. this->label22->Location = System::Drawing::Point(9, 193);
  718. this->label22->Name = L"label22";
  719. this->label22->Size = System::Drawing::Size(38, 13);
  720. this->label22->TabIndex = 33;
  721. this->label22->Text = L"Turn L";
  722. //
  723. // label14
  724. //
  725. this->label14->AutoSize = true;
  726. this->label14->Location = System::Drawing::Point(111, 142);
  727. this->label14->Name = L"label14";
  728. this->label14->Size = System::Drawing::Size(34, 13);
  729. this->label14->TabIndex = 29;
  730. this->label14->Text = L"Full R";
  731. //
  732. // label15
  733. //
  734. this->label15->AutoSize = true;
  735. this->label15->Location = System::Drawing::Point(111, 79);
  736. this->label15->Name = L"label15";
  737. this->label15->Size = System::Drawing::Size(15, 13);
  738. this->label15->TabIndex = 28;
  739. this->label15->Text = L"N";
  740. //
  741. // label16
  742. //
  743. this->label16->AutoSize = true;
  744. this->label16->Location = System::Drawing::Point(111, 13);
  745. this->label16->Name = L"label16";
  746. this->label16->Size = System::Drawing::Size(32, 13);
  747. this->label16->TabIndex = 27;
  748. this->label16->Text = L"Full F";
  749. //
  750. // label4
  751. //
  752. this->label4->AutoSize = true;
  753. this->label4->Location = System::Drawing::Point(12, 71);
  754. this->label4->Name = L"label4";
  755. this->label4->Size = System::Drawing::Size(122, 13);
  756. this->label4->TabIndex = 26;
  757. this->label4->Text = L"Last Message Received";
  758. //
  759. // lastReceived
  760. //
  761. this->lastReceived->Location = System::Drawing::Point(136, 69);
  762. this->lastReceived->Name = L"lastReceived";
  763. this->lastReceived->ReadOnly = true;
  764. this->lastReceived->Size = System::Drawing::Size(352, 20);
  765. this->lastReceived->TabIndex = 25;
  766. //
  767. // lightToggle
  768. //
  769. this->lightToggle->BackColor = System::Drawing::SystemColors::ControlDarkDark;
  770. this->lightToggle->Location = System::Drawing::Point(315, 27);
  771. this->lightToggle->Name = L"lightToggle";
  772. this->lightToggle->Size = System::Drawing::Size(54, 51);
  773. this->lightToggle->TabIndex = 27;
  774. this->lightToggle->Text = L"Light OFF";
  775. this->lightToggle->UseVisualStyleBackColor = false;
  776. this->lightToggle->Click += gcnew System::EventHandler(this, &Form1::lightToggle_Click);
  777. //
  778. // groupBox6
  779. //
  780. this->groupBox6->Controls->Add(this->label4);
  781. this->groupBox6->Controls->Add(this->lastReceived);
  782. this->groupBox6->Controls->Add(this->label3);
  783. this->groupBox6->Controls->Add(this->receivedLog);
  784. this->groupBox6->Controls->Add(this->label2);
  785. this->groupBox6->Controls->Add(this->lastCommand);
  786. this->groupBox6->Controls->Add(this->label1);
  787. this->groupBox6->Controls->Add(this->sentLog);
  788. this->groupBox6->Location = System::Drawing::Point(6, 14);
  789. this->groupBox6->Name = L"groupBox6";
  790. this->groupBox6->Size = System::Drawing::Size(593, 274);
  791. this->groupBox6->TabIndex = 39;
  792. this->groupBox6->TabStop = false;
  793. this->groupBox6->Text = L"Messages";
  794. //
  795. // button1
  796. //
  797. this->button1->Location = System::Drawing::Point(923, 364);
  798. this->button1->Name = L"button1";
  799. this->button1->Size = System::Drawing::Size(55, 25);
  800. this->button1->TabIndex = 40;
  801. this->button1->Text = L"Debug ";
  802. this->button1->UseVisualStyleBackColor = true;
  803. this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
  804. //
  805. // groupBox4
  806. //
  807. this->groupBox4->Controls->Add(this->label30);
  808. this->groupBox4->Controls->Add(this->label29);
  809. this->groupBox4->Controls->Add(this->label28);
  810. this->groupBox4->Controls->Add(this->label27);
  811. this->groupBox4->Controls->Add(this->label26);
  812. this->groupBox4->Controls->Add(this->label25);
  813. this->groupBox4->Controls->Add(this->label24);
  814. this->groupBox4->Controls->Add(this->label23);
  815. this->groupBox4->Location = System::Drawing::Point(13, 23);
  816. this->groupBox4->Name = L"groupBox4";
  817. this->groupBox4->Size = System::Drawing::Size(126, 109);
  818. this->groupBox4->TabIndex = 37;
  819. this->groupBox4->TabStop = false;
  820. this->groupBox4->Text = L"Compass";
  821. //
  822. // label30
  823. //
  824. this->label30->AutoSize = true;
  825. this->label30->Location = System::Drawing::Point(25, 32);
  826. this->label30->Name = L"label30";
  827. this->label30->Size = System::Drawing::Size(26, 13);
  828. this->label30->TabIndex = 36;
  829. this->label30->Text = L"NW";
  830. //
  831. // label29
  832. //
  833. this->label29->AutoSize = true;
  834. this->label29->Location = System::Drawing::Point(12, 50);
  835. this->label29->Name = L"label29";
  836. this->label29->Size = System::Drawing::Size(18, 13);
  837. this->label29->TabIndex = 35;
  838. this->label29->Text = L"W";
  839. //
  840. // label28
  841. //
  842. this->label28->AutoSize = true;
  843. this->label28->Location = System::Drawing::Point(25, 68);
  844. this->label28->Name = L"label28";
  845. this->label28->Size = System::Drawing::Size(25, 13);
  846. this->label28->TabIndex = 34;
  847. this->label28->Text = L"SW";
  848. //
  849. // label27
  850. //
  851. this->label27->AutoSize = true;
  852. this->label27->Location = System::Drawing::Point(53, 85);
  853. this->label27->Name = L"label27";
  854. this->label27->Size = System::Drawing::Size(14, 13);
  855. this->label27->TabIndex = 33;
  856. this->label27->Text = L"S";
  857. //
  858. // label26
  859. //
  860. this->label26->AutoSize = true;
  861. this->label26->Location = System::Drawing::Point(74, 68);
  862. this->label26->Name = L"label26";
  863. this->label26->Size = System::Drawing::Size(21, 13);
  864. this->label26->TabIndex = 32;
  865. this->label26->Text = L"SE";
  866. //
  867. // label25
  868. //
  869. this->label25->AutoSize = true;
  870. this->label25->Location = System::Drawing::Point(98, 50);
  871. this->label25->Name = L"label25";
  872. this->label25->Size = System::Drawing::Size(14, 13);
  873. this->label25->TabIndex = 31;
  874. this->label25->Text = L"E";
  875. //
  876. // label24
  877. //
  878. this->label24->AutoSize = true;
  879. this->label24->Location = System::Drawing::Point(73, 32);
  880. this->label24->Name = L"label24";
  881. this->label24->Size = System::Drawing::Size(22, 13);
  882. this->label24->TabIndex = 30;
  883. this->label24->Text = L"NE";
  884. //
  885. // label23
  886. //
  887. this->label23->Location = System::Drawing::Point(52, 17);
  888. this->label23->Name = L"label23";
  889. this->label23->Size = System::Drawing::Size(68, 15);
  890. this->label23->TabIndex = 29;
  891. this->label23->Text = L"N";
  892. //
  893. // menuStrip1
  894. //
  895. this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(3) {this->fileToolStripMenuItem,
  896. this->editToolStripMenuItem, this->viewToolStripMenuItem});
  897. this->menuStrip1->Location = System::Drawing::Point(0, 0);
  898. this->menuStrip1->Name = L"menuStrip1";
  899. this->menuStrip1->Size = System::Drawing::Size(1017, 24);
  900. this->menuStrip1->TabIndex = 42;
  901. this->menuStrip1->Text = L"menuStrip1";
  902. //
  903. // fileToolStripMenuItem
  904. //
  905. this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->exitToolStripMenuItem});
  906. this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
  907. this->fileToolStripMenuItem->Size = System::Drawing::Size(37, 20);
  908. this->fileToolStripMenuItem->Text = L"File";
  909. //
  910. // exitToolStripMenuItem
  911. //
  912. this->exitToolStripMenuItem->Name = L"exitToolStripMenuItem";
  913. this->exitToolStripMenuItem->Size = System::Drawing::Size(92, 22);
  914. this->exitToolStripMenuItem->Text = L"Exit";
  915. //
  916. // editToolStripMenuItem
  917. //
  918. this->editToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->resetToolStripMenuItem});
  919. this->editToolStripMenuItem->Name = L"editToolStripMenuItem";
  920. this->editToolStripMenuItem->Size = System::Drawing::Size(39, 20);
  921. this->editToolStripMenuItem->Text = L"Edit";
  922. //
  923. // resetToolStripMenuItem
  924. //
  925. this->resetToolStripMenuItem->Name = L"resetToolStripMenuItem";
  926. this->resetToolStripMenuItem->Size = System::Drawing::Size(102, 22);
  927. this->resetToolStripMenuItem->Text = L"Reset";
  928. //
  929. // viewToolStripMenuItem
  930. //
  931. this->viewToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->onlineHelpToolStripMenuItem});
  932. this->viewToolStripMenuItem->Name = L"viewToolStripMenuItem";
  933. this->viewToolStripMenuItem->Size = System::Drawing::Size(44, 20);
  934. this->viewToolStripMenuItem->Text = L"Help";
  935. //
  936. // onlineHelpToolStripMenuItem
  937. //
  938. this->onlineHelpToolStripMenuItem->Name = L"onlineHelpToolStripMenuItem";
  939. this->onlineHelpToolStripMenuItem->Size = System::Drawing::Size(137, 22);
  940. this->onlineHelpToolStripMenuItem->Text = L"Online Help";
  941. //
  942. // trackBar5
  943. //
  944. this->trackBar5->Location = System::Drawing::Point(45, 23);
  945. this->trackBar5->Maximum = 100;
  946. this->trackBar5->Name = L"trackBar5";
  947. this->trackBar5->Orientation = System::Windows::Forms::Orientation::Vertical;
  948. this->trackBar5->Size = System::Drawing::Size(45, 113);
  949. this->trackBar5->TabIndex = 43;
  950. this->trackBar5->TickFrequency = 50;
  951. //
  952. // groupBox5
  953. //
  954. this->groupBox5->Controls->Add(this->label34);
  955. this->groupBox5->Controls->Add(this->label33);
  956. this->groupBox5->Controls->Add(this->label32);
  957. this->groupBox5->Controls->Add(this->label31);
  958. this->groupBox5->Controls->Add(this->trackBar5);
  959. this->groupBox5->Location = System::Drawing::Point(169, 23);
  960. this->groupBox5->Name = L"groupBox5";
  961. this->groupBox5->Size = System::Drawing::Size(96, 142);
  962. this->groupBox5->TabIndex = 44;
  963. this->groupBox5->TabStop = false;
  964. this->groupBox5->Text = L"Battery Charge";
  965. //
  966. // label34
  967. //
  968. this->label34->AutoSize = true;
  969. this->label34->ForeColor = System::Drawing::Color::OliveDrab;
  970. this->label34->Location = System::Drawing::Point(21, 50);
  971. this->label34->Name = L"label34";
  972. this->label34->Size = System::Drawing::Size(19, 13);
  973. this->label34->TabIndex = 47;
  974. this->label34->Text = L"75";
  975. //
  976. // label33
  977. //
  978. this->label33->AutoSize = true;
  979. this->label33->ForeColor = System::Drawing::Color::Crimson;
  980. this->label33->Location = System::Drawing::Point(21, 82);
  981. this->label33->Name = L"label33";
  982. this->label33->Size = System::Drawing::Size(19, 13);
  983. this->label33->TabIndex = 46;
  984. this->label33->Text = L"40";
  985. //
  986. // label32
  987. //
  988. this->label32->AutoSize = true;
  989. this->label32->ForeColor = System::Drawing::Color::Crimson;
  990. this->label32->Location = System::Drawing::Point(27, 116);
  991. this->label32->Name = L"label32";
  992. this->label32->Size = System::Drawing::Size(13, 13);
  993. this->label32->TabIndex = 45;
  994. this->label32->Text = L"0";
  995. //
  996. // label31
  997. //
  998. this->label31->AutoSize = true;
  999. this->label31->ForeColor = System::Drawing::Color::OliveDrab;
  1000. this->label31->Location = System::Drawing::Point(15, 23);
  1001. this->label31->Name = L"label31";
  1002. this->label31->Size = System::Drawing::Size(25, 13);
  1003. this->label31->TabIndex = 44;
  1004. this->label31->Text = L"100";
  1005. //
  1006. // tabControl1
  1007. //
  1008. this->tabControl1->Controls->Add(this->tabPage1);
  1009. this->tabControl1->Controls->Add(this->tabPage2);
  1010. this->tabControl1->Location = System::Drawing::Point(12, 27);
  1011. this->tabControl1->Name = L"tabControl1";
  1012. this->tabControl1->SelectedIndex = 0;
  1013. this->tabControl1->Size = System::Drawing::Size(1000, 468);
  1014. this->tabControl1->TabIndex = 45;
  1015. //
  1016. // tabPage1
  1017. //
  1018. this->tabPage1->Controls->Add(this->textBox7);
  1019. this->tabPage1->Controls->Add(this->textBox6);
  1020. this->tabPage1->Controls->Add(this->radioButton1);
  1021. this->tabPage1->Controls->Add(this->hardwareOff);
  1022. this->tabPage1->Controls->Add(this->surface);
  1023. this->tabPage1->Controls->Add(this->getSensor);
  1024. this->tabPage1->Controls->Add(this->getBattery);
  1025. this->tabPage1->Controls->Add(this->groupBox5);
  1026. this->tabPage1->Controls->Add(this->groupBox4);
  1027. this->tabPage1->Controls->Add(this->lightToggle);
  1028. this->tabPage1->Location = System::Drawing::Point(4, 22);
  1029. this->tabPage1->Name = L"tabPage1";
  1030. this->tabPage1->Padding = System::Windows::Forms::Padding(3);
  1031. this->tabPage1->Size = System::Drawing::Size(992, 442);
  1032. this->tabPage1->TabIndex = 0;
  1033. this->tabPage1->Text = L"Main";
  1034. this->tabPage1->UseVisualStyleBackColor = true;
  1035. //
  1036. // radioButton1
  1037. //
  1038. this->radioButton1->AutoSize = true;
  1039. this->radioButton1->FlatStyle = System::Windows::Forms::FlatStyle::Popup;
  1040. this->radioButton1->Location = System::Drawing::Point(199, 233);
  1041. this->radioButton1->Name = L"radioButton1";
  1042. this->radioButton1->Size = System::Drawing::Size(13, 12);
  1043. this->radioButton1->TabIndex = 49;
  1044. this->radioButton1->TabStop = true;
  1045. this->radioButton1->UseVisualStyleBackColor = true;
  1046. //
  1047. // hardwareOff
  1048. //
  1049. this->hardwareOff->BackColor = System::Drawing::SystemColors::ActiveCaption;
  1050. this->hardwareOff->Location = System::Drawing::Point(555, 27);
  1051. this->hardwareOff->Name = L"hardwareOff";
  1052. this->hardwareOff->Size = System::Drawing::Size(54, 51);
  1053. this->hardwareOff->TabIndex = 48;
  1054. this->hardwareOff->Text = L"Turn All HW Off";
  1055. this->hardwareOff->UseVisualStyleBackColor = false;
  1056. this->hardwareOff->Click += gcnew System::EventHandler(this, &Form1::hardwareOff_Click);
  1057. //
  1058. // surface
  1059. //
  1060. this->surface->BackColor = System::Drawing::SystemColors::ActiveCaption;
  1061. this->surface->Location = System::Drawing::Point(495, 27);
  1062. this->surface->Name = L"surface";
  1063. this->surface->Size = System::Drawing::Size(54, 51);
  1064. this->surface->TabIndex = 47;
  1065. this->surface->Text = L"Surface";
  1066. this->surface->UseVisualStyleBackColor = false;
  1067. this->surface->Click += gcnew System::EventHandler(this, &Form1::surface_Click_1);
  1068. //
  1069. // getSensor
  1070. //
  1071. this->getSensor->BackColor = System::Drawing::SystemColors::ActiveCaption;
  1072. this->getSensor->Location = System::Drawing::Point(375, 27);
  1073. this->getSensor->Name = L"getSensor";
  1074. this->getSensor->Size = System::Drawing::Size(54, 51);
  1075. this->getSensor->TabIndex = 46;
  1076. this->getSensor->Text = L"Update Sensor";
  1077. this->getSensor->UseVisualStyleBackColor = false;
  1078. this->getSensor->Click += gcnew System::EventHandler(this, &Form1::getSensor_Click_1);
  1079. //
  1080. // getBattery
  1081. //
  1082. this->getBattery->BackColor = System::Drawing::SystemColors::ActiveCaption;
  1083. this->getBattery->Location = System::Drawing::Point(435, 27);
  1084. this->getBattery->Name = L"getBattery";
  1085. this->getBattery->Size = System::Drawing::Size(54, 51);
  1086. this->getBattery->TabIndex = 45;
  1087. this->getBattery->Text = L"Update Battery";
  1088. this->getBattery->UseVisualStyleBackColor = false;
  1089. this->getBattery->Click += gcnew System::EventHandler(this, &Form1::getBattery_Click_1);
  1090. //
  1091. // tabPage2
  1092. //
  1093. this->tabPage2->Controls->Add(this->groupBox7);
  1094. this->tabPage2->Controls->Add(this->groupBox1);
  1095. this->tabPage2->Controls->Add(this->button1);
  1096. this->tabPage2->Controls->Add(this->groupBox6);
  1097. this->tabPage2->Location = System::Drawing::Point(4, 22);
  1098. this->tabPage2->Name = L"tabPage2";
  1099. this->tabPage2->Padding = System::Windows::Forms::Padding(3);
  1100. this->tabPage2->Size = System::Drawing::Size(992, 442);
  1101. this->tabPage2->TabIndex = 1;
  1102. this->tabPage2->Text = L"Debug";
  1103. this->tabPage2->UseVisualStyleBackColor = true;
  1104. //
  1105. // groupBox7
  1106. //
  1107. this->groupBox7->Controls->Add(this->sServoPlus);
  1108. this->groupBox7->Controls->Add(this->label35);
  1109. this->groupBox7->Controls->Add(this->bServoPlus);
  1110. this->groupBox7->Controls->Add(this->label10);
  1111. this->groupBox7->Controls->Add(this->bServoMinus);
  1112. this->groupBox7->Controls->Add(this->sServoMinus);
  1113. this->groupBox7->Location = System::Drawing::Point(6, 303);
  1114. this->groupBox7->Name = L"groupBox7";
  1115. this->groupBox7->Size = System::Drawing::Size(102, 96);
  1116. this->groupBox7->TabIndex = 47;
  1117. this->groupBox7->TabStop = false;
  1118. this->groupBox7->Text = L"Servo Control";
  1119. //
  1120. // sServoPlus
  1121. //
  1122. this->sServoPlus->Location = System::Drawing::Point(60, 41);
  1123. this->sServoPlus->Name = L"sServoPlus";
  1124. this->sServoPlus->Size = System::Drawing::Size(29, 20);
  1125. this->sServoPlus->TabIndex = 43;
  1126. this->sServoPlus->Text = L"+";
  1127. this->sServoPlus->UseVisualStyleBackColor = true;
  1128. this->sServoPlus->Click += gcnew System::EventHandler(this, &Form1::sServoPlus_Click);
  1129. //
  1130. // label35
  1131. //
  1132. this->label35->AutoSize = true;
  1133. this->label35->Location = System::Drawing::Point(52, 23);
  1134. this->label35->Name = L"label35";
  1135. this->label35->Size = System::Drawing::Size(45, 13);
  1136. this->label35->TabIndex = 46;
  1137. this->label35->Text = L"S Servo";
  1138. //
  1139. // bServoPlus
  1140. //
  1141. this->bServoPlus->Location = System::Drawing::Point(14, 41);
  1142. this->bServoPlus->Name = L"bServoPlus";
  1143. this->bServoPlus->Size = System::Drawing::Size(29, 20);
  1144. this->bServoPlus->TabIndex = 41;
  1145. this->bServoPlus->Text = L"+";
  1146. this->bServoPlus->UseVisualStyleBackColor = true;
  1147. this->bServoPlus->Click += gcnew System::EventHandler(this, &Form1::bServoPlus_Click);
  1148. //
  1149. // label10
  1150. //
  1151. this->label10->AutoSize = true;
  1152. this->label10->Location = System::Drawing::Point(6, 23);
  1153. this->label10->Name = L"label10";
  1154. this->label10->Size = System::Drawing::Size(45, 13);
  1155. this->label10->TabIndex = 45;
  1156. this->label10->Text = L"B Servo";
  1157. //
  1158. // bServoMinus
  1159. //
  1160. this->bServoMinus->Location = System::Drawing::Point(14, 67);
  1161. this->bServoMinus->Name = L"bServoMinus";
  1162. this->bServoMinus->Size = System::Drawing::Size(29, 20);
  1163. this->bServoMinus->TabIndex = 42;
  1164. this->bServoMinus->Text = L"-";
  1165. this->bServoMinus->UseVisualStyleBackColor = true;
  1166. this->bServoMinus->Click += gcnew System::EventHandler(this, &Form1::bServoMinus_Click);
  1167. //
  1168. // sServoMinus
  1169. //
  1170. this->sServoMinus->Location = System::Drawing::Point(59, 66);
  1171. this->sServoMinus->Name = L"sServoMinus";
  1172. this->sServoMinus->Size = System::Drawing::Size(31, 20);
  1173. this->sServoMinus->TabIndex = 44;
  1174. this->sServoMinus->Text = L"-";
  1175. this->sServoMinus->UseVisualStyleBackColor = true;
  1176. this->sServoMinus->Click += gcnew System::EventHandler(this, &Form1::sServoMinus_Click);
  1177. //
  1178. // textBox6
  1179. //
  1180. this->textBox6->Location = System::Drawing::Point(249, 231);
  1181. this->textBox6->Name = L"textBox6";
  1182. this->textBox6->Size = System::Drawing::Size(45, 20);
  1183. this->textBox6->TabIndex = 50;
  1184. //
  1185. // textBox7
  1186. //
  1187. this->textBox7->Location = System::Drawing::Point(315, 230);
  1188. this->textBox7->Name = L"textBox7";
  1189. this->textBox7->Size = System::Drawing::Size(45, 20);
  1190. this->textBox7->TabIndex = 51;
  1191. //
  1192. // Form1
  1193. //
  1194. this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
  1195. this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
  1196. this->ClientSize = System::Drawing::Size(1017, 507);
  1197. this->Controls->Add(this->tabControl1);
  1198. this->Controls->Add(this->menuStrip1);
  1199. this->KeyPreview = true;
  1200. this->MainMenuStrip = this->menuStrip1;
  1201. this->Name = L"Form1";
  1202. this->Text = L"SWIMIR Command Center";
  1203. this->FormClosing += gcnew System::Windows::Forms::FormClosingEventHandler(this, &Form1::Form1_FormClosing);
  1204. this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
  1205. this->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  1206. (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->trackBar1))->EndInit();
  1207. (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->trackBar2))->EndInit();
  1208. (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->trackBar3))->EndInit();
  1209. (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->trackBar4))->EndInit();
  1210. this->groupBox1->ResumeLayout(false);
  1211. this->groupBox1->PerformLayout();
  1212. this->groupBox3->ResumeLayout(false);
  1213. this->groupBox3->PerformLayout();
  1214. this->groupBox2->ResumeLayout(false);
  1215. this->groupBox2->PerformLayout();
  1216. this->groupBox6->ResumeLayout(false);
  1217. this->groupBox6->PerformLayout();
  1218. this->groupBox4->ResumeLayout(false);
  1219. this->groupBox4->PerformLayout();
  1220. this->menuStrip1->ResumeLayout(false);
  1221. this->menuStrip1->PerformLayout();
  1222. (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->trackBar5))->EndInit();
  1223. this->groupBox5->ResumeLayout(false);
  1224. this->groupBox5->PerformLayout();
  1225. this->tabControl1->ResumeLayout(false);
  1226. this->tabPage1->ResumeLayout(false);
  1227. this->tabPage1->PerformLayout();
  1228. this->tabPage2->ResumeLayout(false);
  1229. this->groupBox7->ResumeLayout(false);
  1230. this->groupBox7->PerformLayout();
  1231. this->ResumeLayout(false);
  1232. this->PerformLayout();
  1233.  
  1234. }
  1235. #pragma endregion
  1236.  
  1237. private:
  1238.  
  1239. int counter,counter1,counter2, counter3, counter4;
  1240. int countcycles;
  1241. String^ buffer;
  1242. String^ lastcommand;
  1243. String^ sendData;
  1244. String^ receivedMsg;
  1245. String^ receivedMsg2;
  1246. String^ receivedSensorData;
  1247. String^ receivedBatteryData;
  1248. int lMtrSpeed, rMtrSpeed;
  1249. int x,y,z,r;
  1250. int xbuf, ybuf, zbuf, rbuf;
  1251. int bldir, brdir, sldir, srdir;
  1252. int bs, ss;
  1253. int light, sensor, battery;
  1254. int timeToOutput;
  1255. __int32 rawSensorData;
  1256. __int32 rawBatteryData;
  1257. bool putIntoX, putIntoY, putIntoZ, putIntoR, putIntoB;
  1258.  
  1259. //practice
  1260. bool fillMessage;
  1261. String^ incomingMessage;
  1262. int charCounter;
  1263. void Form1_KeyPress(Object^ sender, KeyPressEventArgs^ e)
  1264. {
  1265. if(e->KeyChar=='*'){
  1266. fillMessage = true;
  1267. }
  1268. if(fillMessage == true && e->KeyChar != '*'){
  1269.  
  1270. charCounter++;
  1271. switch(charCounter)
  1272. {
  1273. case 1:
  1274. textBox1->Text = "" + e->KeyChar;
  1275. break;
  1276. case 2:
  1277. textBox1->Text = textBox1->Text + e->KeyChar;
  1278. break;
  1279. case 3:
  1280. textBox1->Text = textBox1->Text + e->KeyChar;
  1281. x = int::Parse(textBox1->Text);
  1282. trackBar1->Value = x;
  1283. //timeToOutput=1;
  1284. break;
  1285. case 4:
  1286. textBox2->Text = "" + e->KeyChar;
  1287. break;
  1288. case 5:
  1289. textBox2->Text = textBox2->Text + e->KeyChar;
  1290. break;
  1291. case 6:
  1292. textBox2->Text = textBox2->Text + e->KeyChar;
  1293. y = int::Parse(textBox2->Text);
  1294. int ydummy;
  1295. ydummy =y;
  1296. ydummy = 100-ydummy;
  1297. trackBar2->Value = ydummy;
  1298. //timeToOutput=1;
  1299. break;
  1300. case 7:
  1301. textBox3->Text = "" + e->KeyChar;
  1302. break;
  1303. case 8:
  1304. textBox3->Text = textBox3->Text + e->KeyChar;
  1305. break;
  1306. case 9:
  1307. textBox3->Text = textBox3->Text + e->KeyChar;
  1308. z = int::Parse(textBox3->Text);
  1309. trackBar3->Value = z;
  1310. //timeToOutput=1;
  1311. break;
  1312. case 10:
  1313. textBox4->Text = "" + e->KeyChar;
  1314. break;
  1315. case 11:
  1316. textBox4->Text = textBox4->Text + e->KeyChar;
  1317. break;
  1318. case 12:
  1319. textBox4->Text = textBox4->Text + e->KeyChar;
  1320. r = int::Parse(textBox4->Text);
  1321. int rdummy;
  1322. rdummy = 100-r;
  1323. trackBar4->Value = rdummy;
  1324.  
  1325. fillMessage = false;
  1326. charCounter = 0;
  1327. timeToOutput=1;
  1328. break;
  1329. }
  1330.  
  1331.  
  1332.  
  1333. }
  1334.  
  1335. //For Buttons*************************************************************************************
  1336. if(e->KeyChar=='b'){
  1337. counter4++;
  1338. putIntoB = true;
  1339. textBox5->Text = "";
  1340. }
  1341. if(counter4>4){counter4=0; putIntoB=false; }
  1342. if(putIntoB==true && counter4>0){
  1343. counter4++;
  1344. if(counter4==5){
  1345. textBox5->Text = "" + e->KeyChar;
  1346.  
  1347. switch(e->KeyChar)
  1348. {
  1349. case '1':
  1350. lastCommand->Text = "Get Battery Data";
  1351. battery = 1;
  1352. timeToOutput = 1;
  1353. break;
  1354. case '2':
  1355. lastCommand->Text = "Light Switched!";
  1356. if(lightToggle->Text == "Light OFF")
  1357. {
  1358. lightToggle->Text = "Light ON";
  1359. lastCommand->Text = "Light ON";
  1360. lightToggle->BackColor = System::Drawing::SystemColors::Info;
  1361. light = 1;
  1362. timeToOutput = 1;
  1363. }
  1364. else
  1365. {
  1366. lightToggle->Text = "Light OFF";
  1367. lastCommand->Text = "Light OFF";
  1368. lightToggle->BackColor = System::Drawing::SystemColors::ControlDarkDark;
  1369. light = 0;
  1370. timeToOutput = 1;
  1371. }
  1372. break;
  1373. case '3':
  1374. lastCommand->Text = "Get Sensor Data";
  1375. sensor = 1;
  1376. timeToOutput = 1;
  1377. break;
  1378. case '4':
  1379. break;
  1380. case '5':
  1381. ss = ss + 1;
  1382. if(ss>9){ss=9;}
  1383. timeToOutput = 1;
  1384. break;
  1385. case '6':
  1386. bs = bs + 1;
  1387. if(bs>9){bs=9;}
  1388. timeToOutput = 1;
  1389. break;
  1390. case '7':
  1391. ss = ss - 1;
  1392. if(ss<0){ss=0;}
  1393. timeToOutput = 1;
  1394. break;
  1395. case '8':
  1396. bs = bs - 1;
  1397. if(bs<0){bs=0;}
  1398. timeToOutput = 1;
  1399. break;
  1400. default:
  1401. break;
  1402. }
  1403. }
  1404. }
  1405.  
  1406.  
  1407. //***************************************************************************************
  1408. if(timeToOutput == 1){
  1409. ///UPDATED MOTOR CONTROL
  1410. if(xbuf == x){x=50;}
  1411. xbuf = x;
  1412.  
  1413. if(ybuf == y){y=50;}
  1414. ybuf = y;
  1415.  
  1416. if(zbuf == z){z=50;}
  1417. zbuf = z;
  1418.  
  1419. if(rbuf == r){r=50;}
  1420. rbuf = r;
  1421.  
  1422.  
  1423. //BL
  1424. if(x>=46 && x<=54){x=0;} else{
  1425. if(x==100){x=99;}
  1426. if(x<46){
  1427. bldir = 0;
  1428. x = (abs(x-45))/5;
  1429. if(xbuf == x){x=0;}
  1430. xbuf = x;
  1431. }
  1432. if(x>54){
  1433. bldir = 1;
  1434. x = x - 54;
  1435. x = x/5;
  1436. if(xbuf == x){x=0;}
  1437. xbuf = x;
  1438. }
  1439. }
  1440.  
  1441. //BR
  1442. if(y>=46 && y<=54){y=0;} else{
  1443. if(y==100){y=99;}
  1444. if(y<46){
  1445. brdir = 0;
  1446. y = (abs(y-45))/5;
  1447. if(ybuf == y){y=0;}
  1448. ybuf = y;
  1449. }
  1450. if(y>54){
  1451. brdir = 1;
  1452. y = y - 54;
  1453. y = y/5;
  1454. if(ybuf == y){y=0;}
  1455. ybuf = y;
  1456. }
  1457. }
  1458.  
  1459. //SL
  1460. if(z>=46 && z<=54){z=0;} else{
  1461. if(z==100){z=99;}
  1462. if(z<46){
  1463. sldir = 0;
  1464. z = (abs(z-45))/5;
  1465. if(zbuf == z){z=0;}
  1466. zbuf = z;
  1467. }
  1468. if(z>54){
  1469. sldir = 1;
  1470. z = z - 54;
  1471. z = z/5;
  1472. if(zbuf == z){z=0;}
  1473. zbuf = z;
  1474. }
  1475. }
  1476.  
  1477. //SR
  1478. if(r>=46 && r<=54){r=0;}else{
  1479. if(r==100){r=99;}
  1480. if(r<46){
  1481. srdir = 0;
  1482. r = (abs(r-45))/5;
  1483. if(rbuf == r){r=0;}
  1484. rbuf = r;
  1485. }
  1486. if(r>54){
  1487. srdir = 1;
  1488. r = r - 54;
  1489. r = r/5;
  1490. if(rbuf == r){r=0;}
  1491. rbuf = r;
  1492. }
  1493. }
  1494.  
  1495. sendCOMData();
  1496.  
  1497. }
  1498. timeToOutput = 0;
  1499. }
  1500.  
  1501. private: System::Void sendCOMData(){
  1502. comPort->WriteLine("*BL"+x+bldir+"BR"+y+brdir+"SL"+z+sldir+"SR"+r+srdir+"BS"+bs+"SS"+ss+"L"+light+"S"+sensor+"B"+battery+":");
  1503. lastCommand->Text = "*BL"+x+bldir+"BR"+y+brdir+"SL"+z+sldir+"SR"+r+srdir+"BS"+bs+"SS"+ss+"L"+light+"S"+sensor+"B"+battery+":"+"\n";
  1504. sentLog->Text = sentLog->Text + "*BL"+x+bldir+"BR"+y+brdir+"SL"+z+sldir+"SR"+r+srdir+"BS"+bs+"SS"+ss+"L"+light+"S"+sensor+"B"+battery+":"+"\n";
  1505.  
  1506. String^ publicDataToSendString = lastCommand->Text;
  1507. publicDataToSendString = "12345678912345678912345678912345";
  1508. for(int k=0;k<32;k++){
  1509. publicDataToSend[k]= publicDataToSendString[k];
  1510. }
  1511.  
  1512. //Auto Scroll stuff
  1513. sentLog->SelectionStart = sentLog->Text->Length;
  1514. sentLog->ScrollToCaret();
  1515.  
  1516. if(battery){
  1517. receivedMsg = comPort->ReadLine();
  1518. receivedLog->Text = receivedLog->Text + "\r\n" + receivedMsg;
  1519. lastReceived->Text = receivedMsg;
  1520. receivedBatteryData = receivedMsg->Remove(0,25);
  1521. rawBatteryData = System::Int32::Parse(receivedBatteryData);
  1522. trackBar5->Value = rawBatteryData;
  1523. battery = 0;
  1524. }
  1525. if(sensor){
  1526. receivedMsg = comPort->ReadLine();
  1527. receivedLog->Text = receivedLog->Text + "\r\n" + receivedMsg;
  1528. lastReceived->Text = receivedMsg;
  1529. receivedSensorData = receivedMsg->Remove(0,3);
  1530. rawSensorData = System::Int32::Parse(receivedSensorData);
  1531. sensor = 0;
  1532. float rawSensorDataInt;
  1533. rawSensorDataInt = rawSensorData;
  1534. radioButton1->Location = Point(200+50*cos(((2*3.141592)/180)*rawSensorDataInt), 50*sin(200+((2*3.141592)/180)*rawSensorDataInt));
  1535.  
  1536. timeToOutput = 0;
  1537. }
  1538.  
  1539. }
  1540. private: System::Void textBox5_TextChanged(System::Object^ sender, System::EventArgs^ e) {
  1541. //String^ toSend = textBox5->Text;
  1542. //sentLog->Text = sentLog->Text +"\r\n" + toSend;
  1543. //lastCommand->Text = toSend;
  1544. //comPort->WriteLine(toSend);
  1545. //receivedLog->Text = receivedLog->Text + "\r\n" + comPort->ReadLine();
  1546. }
  1547. private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
  1548. Thread^ oThread = gcnew Thread( gcnew ThreadStart( &ThreadExample::ThreadProc ) );
  1549. oThread->Start();
  1550. //oThread->Join();
  1551. //comPort = gcnew SerialPort("COM8", 115200);
  1552. //comPort->Open();
  1553. //sentLog->Text = "COM8 Opened";
  1554. }
  1555. private: System::Void Form1_FormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ ) {
  1556. //comPort->Close();
  1557. //sentLog->Text = "COM8 Closed";
  1558. }
  1559. private: System::Void lightToggle_Click(System::Object^ sender, System::EventArgs^ e) {
  1560.  
  1561. lastCommand->Text = "Light Switched!";
  1562. if(lightToggle->Text == "Light OFF")
  1563. {
  1564. lightToggle->Text = "Light ON";
  1565. lastCommand->Text = "Light ON";
  1566. lightToggle->BackColor = System::Drawing::SystemColors::Info;
  1567. light = 1;
  1568. timeToOutput = 1;
  1569. }
  1570. else
  1571. {
  1572. lightToggle->Text = "Light OFF";
  1573. lastCommand->Text = "Light OFF";
  1574. lightToggle->BackColor = System::Drawing::SystemColors::ControlDarkDark;
  1575. light = 0;
  1576. timeToOutput = 1;
  1577. }
  1578. sendCOMData();
  1579. }
  1580.  
  1581. private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
  1582. ////Debugging Code
  1583. //comPort->WriteLine("*BL30BR41SL80SR91BS1SS1L0S0B0:");
  1584. //receivedMsg = comPort->ReadLine();
  1585. //receivedLog->Text = receivedLog->Text + "\r\n" + receivedMsg;
  1586. //lastReceived->Text = receivedMsg;
  1587.  
  1588. //String^ xm = Char::ToString(receivedMsg[2]) + Char::ToString(receivedMsg[3]) + Char::ToString(receivedMsg[4]);
  1589. //String^ ym = Char::ToString(receivedMsg[6]) + Char::ToString(receivedMsg[7]) + Char::ToString(receivedMsg[8]);
  1590. //String^ zm = Char::ToString(receivedMsg[10]) + Char::ToString(receivedMsg[11]) + Char::ToString(receivedMsg[12]);
  1591. //
  1592. //lastReceived->Text = xm+ym+zm;
  1593.  
  1594. //int sx = int::Parse(Char::ToString(receivedMsg[1]));
  1595. //int sy = int::Parse(Char::ToString(receivedMsg[5]));
  1596. //int sz = int::Parse(Char::ToString(receivedMsg[9]));
  1597.  
  1598. //int ixm = int::Parse(xm);
  1599. //int iym = int::Parse(ym);
  1600. //int izm = int::Parse(zm);
  1601.  
  1602.  
  1603. //if(ixm>270 && sx==0 && iym>10 && sy==0 && izm>288 && sz==0){//N
  1604. // this->label23->BackColor = System::Drawing::SystemColors::ControlDark;
  1605. // this->label25->BackColor = System::Drawing::SystemColors::Control;
  1606. // this->label27->BackColor = System::Drawing::SystemColors::Control;
  1607. // this->label29->BackColor = System::Drawing::SystemColors::Control;
  1608. //}
  1609.  
  1610. //if(ixm>153 && sx==0 && iym>17 && sy==0 && izm>231 && sz==0){//S
  1611. // this->label23->BackColor = System::Drawing::SystemColors::Control;
  1612. // this->label25->BackColor = System::Drawing::SystemColors::Control;
  1613. // this->label27->BackColor = System::Drawing::SystemColors::ControlDark;
  1614. // this->label29->BackColor = System::Drawing::SystemColors::Control;
  1615. //}
  1616.  
  1617. //if(ixm>194 && sx==0 && iym>34 && sy==0 && izm>241 && sz==0){//E
  1618. // this->label23->BackColor = System::Drawing::SystemColors::Control;
  1619. // this->label25->BackColor = System::Drawing::SystemColors::ControlDark;
  1620. // this->label27->BackColor = System::Drawing::SystemColors::Control;
  1621. // this->label29->BackColor = System::Drawing::SystemColors::Control;
  1622. //}
  1623.  
  1624. //if(ixm>211 && sx==0 && iym>31 && sy==0 && izm>212 && sz==0){//W
  1625. // this->label23->BackColor = System::Drawing::SystemColors::Control;
  1626. // this->label25->BackColor = System::Drawing::SystemColors::Control;
  1627. // this->label27->BackColor = System::Drawing::SystemColors::Control;
  1628. // this->label29->BackColor = System::Drawing::SystemColors::ControlDark;
  1629. //}
  1630.  
  1631. }
  1632.  
  1633. private: System::Void getSensor_Click_1(System::Object^ sender, System::EventArgs^ e) {
  1634.  
  1635. //if(threadDone = 1){
  1636. //lastCommand->Text = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(IntPtr((publicDataToSend)));
  1637. //threadDone = 0;
  1638. //}
  1639. //lastCommand->Text = "Get Sensor Data";
  1640. //sensor = 1;
  1641. //timeToOutput = 1;
  1642. //sendCOMData();
  1643. }
  1644.  
  1645. private: System::Void getBattery_Click_1(System::Object^ sender, System::EventArgs^ e) {
  1646. lastCommand->Text = "Get Battery Data";
  1647. battery = 1;
  1648. timeToOutput = 1;
  1649. sendCOMData();
  1650. }
  1651. private: System::Void surface_Click_1(System::Object^ sender, System::EventArgs^ e) {
  1652. lastCommand->Text = "Surface!";
  1653. x=9;
  1654. y=9;
  1655. z=9;
  1656. r=9;
  1657. bldir=1;
  1658. brdir=1;
  1659. sldir=1;
  1660. srdir=1;
  1661. bs=9;
  1662. ss=9;
  1663. sendCOMData();
  1664. }
  1665.  
  1666. private: System::Void bServoPlus_Click(System::Object^ sender, System::EventArgs^ e) {
  1667. bs = bs + 1;
  1668. if(bs>9){bs=9;}
  1669. timeToOutput = 1;
  1670. sendCOMData();
  1671. }
  1672. private: System::Void bServoMinus_Click(System::Object^ sender, System::EventArgs^ e) {
  1673. bs = bs - 1;
  1674. if(bs<0){bs=0;}
  1675. timeToOutput = 1;
  1676. sendCOMData();
  1677. }
  1678. private: System::Void sServoPlus_Click(System::Object^ sender, System::EventArgs^ e) {
  1679. ss = ss + 1;
  1680. if(ss>9){ss=9;}
  1681. timeToOutput = 1;
  1682. sendCOMData();
  1683. }
  1684. private: System::Void sServoMinus_Click(System::Object^ sender, System::EventArgs^ e) {
  1685. ss = ss - 1;
  1686. if(ss<0){ss=0;}
  1687. timeToOutput = 1;
  1688. sendCOMData();
  1689. }
  1690. private: System::Void hardwareOff_Click(System::Object^ sender, System::EventArgs^ e) {
  1691. lastCommand->Text = "All Hardware Off!";
  1692. x=0;
  1693. y=0;
  1694. z=0;
  1695. r=0;
  1696. bldir=0;
  1697. brdir=0;
  1698. sldir=0;
  1699. srdir=0;
  1700. bs=0;
  1701. ss=0;
  1702. light=0;
  1703. sensor=0;
  1704. battery=0;
  1705. sendCOMData();
  1706. }
  1707.  
  1708.  
  1709.  
  1710. };
  1711. }
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727. ////For X-Axis*************************************************************************************
  1728. //if(e->KeyChar=='x'){
  1729. // counter++;
  1730. // putIntoX = true;
  1731. // textBox1->Text = "";
  1732. //
  1733. //}
  1734. //if(counter>3){counter=0; putIntoX=false; }
  1735. //if(putIntoX==true && counter>0 && e->KeyChar != 'x'){
  1736. // counter++;
  1737. // textBox1->Text = textBox1->Text + e->KeyChar;
  1738. // if(counter>3){
  1739. // x = int::Parse(textBox1->Text);
  1740. // trackBar1->Value = x;
  1741. // timeToOutput=1;
  1742. // }
  1743. //}
  1744. //if(putIntoX==false){
  1745. // //textBox1->Text = "050";
  1746. // //trackBar1->Value = int::Parse(textBox1->Text);
  1747. //}
  1748. //
  1749. ////For Y-Axis*************************************************************************************
  1750. //if(e->KeyChar=='y'){
  1751. // counter1++;
  1752. // putIntoY = true;
  1753. // textBox2->Text = "";
  1754. //}
  1755. //if(counter1>3){counter1=0; putIntoY=false; }
  1756. //if(putIntoY==true && counter1>0 && e->KeyChar != 'y'){
  1757. // counter1++;
  1758. // textBox2->Text = textBox2->Text + e->KeyChar;
  1759. // if(counter1>3){
  1760. // y = int::Parse(textBox2->Text);
  1761. // int ydummy;
  1762. // ydummy =y;
  1763. // ydummy = 100-ydummy;
  1764. // //y=100-y;
  1765. // trackBar2->Value = ydummy;
  1766. // //if(y==100){y=99;}
  1767. // //y = y/10;
  1768. // timeToOutput=1;
  1769. // }
  1770. //}
  1771. //if(putIntoY==false){
  1772. // //textBox2->Text = "050";
  1773. // //trackBar2->Value = int::Parse(textBox2->Text);
  1774. //}
  1775.  
  1776. ////For Z-Axis*************************************************************************************
  1777. //if(e->KeyChar=='z'){
  1778. // counter2++;
  1779. // putIntoZ = true;
  1780. // textBox3->Text = "";
  1781. //}
  1782. //if(counter2>3){counter2=0; putIntoZ=false; }
  1783. //if(putIntoZ==true && counter2>0 && e->KeyChar != 'z'){
  1784. // counter2++;
  1785. // textBox3->Text = textBox3->Text + e->KeyChar;
  1786. // if(counter2>3){
  1787. // z = int::Parse(textBox3->Text);
  1788. // trackBar3->Value = z;
  1789. // //if(z==100){z=99;}
  1790. // //z = z/10;
  1791. // timeToOutput=1;
  1792. // }
  1793. //}
  1794. //if(putIntoZ==false){
  1795. // //textBox3->Text = "050";
  1796. // //trackBar3->Value = int::Parse(textBox3->Text);
  1797. //}
  1798. //
  1799. ////For R-Axis*************************************************************************************
  1800. //if(e->KeyChar=='r'){
  1801. // counter3++;
  1802. // putIntoR = true;
  1803. // textBox4->Text = "";
  1804. //}
  1805. //if(counter3>3){counter3=0; putIntoR=false; }
  1806. //if(putIntoR==true && counter3>0 && e->KeyChar != 'r'){
  1807. // counter3++;
  1808. // textBox4->Text = textBox4->Text + e->KeyChar;
  1809. // if(counter3>3){
  1810. // r = int::Parse(textBox4->Text);
  1811. // int rdummy;
  1812. // rdummy = 100-r;
  1813. // trackBar4->Value = rdummy;
  1814.  
  1815. // //if(r==100){r=99;}
  1816. // //r = r/10;
  1817. // timeToOutput=1;
  1818. // }
  1819. //}
  1820. //if(putIntoR==false){
  1821. // //textBox4->Text = "050";
  1822. // //trackBar4->Value = int::Parse(textBox4->Text);
  1823. //}
Add Comment
Please, Sign In to add comment