Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 44 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1.  #include <WiFi.h>
  2.  
  3. char ssid[] = "Omega";     //  your network SSID (name)
  4. char pass[] = "12345678";  // your network password
  5. int status = WL_IDLE_STATUS;     // the Wifi radio's status
  6.  
  7. int sensorForceData[10];
  8. int gyroX;
  9. int gyroY;
  10. int gyroZ;
  11. int sliderG;
  12. int sliderD;
  13.  
  14. void setup() {
  15.   // initialize serial communication at 9600 bits per second:
  16.   Serial.begin(9600);
  17.    while (!Serial) {
  18.     ; // wait for serial port to connect. Needed for Leonardo only
  19.   }
  20.    // check for the presence of the shield:
  21.   if (WiFi.status() == WL_NO_SHIELD) {
  22.     Serial.println("WiFi shield not present");
  23.     // don't continue:
  24.     while(true);
  25.   }
  26.  
  27.  // attempt to connect to Wifi network:
  28.   while ( status != WL_CONNECTED) {
  29.     Serial.print("Attempting to connect to WPA SSID: ");
  30.     Serial.println(ssid);
  31.     // Connect to WPA/WPA2 network:    
  32.     status = WiFi.begin(ssid, pass);
  33.  
  34.     // wait 10 seconds for connection:
  35.     delay(10000);
  36.   }
  37.    
  38.   // you're connected now, so print out the data:
  39.   Serial.print("You're connected to the network");
  40.   printCurrentNet();
  41.   printWifiData();
  42.  
  43.  
  44.   init();
  45. }
  46.  
  47. // the loop routine runs over and over again forever:
  48. void loop() {
  49.     // check the network connection once every 10 seconds:
  50.   delay(10000);
  51.   printCurrentNet();
  52.  getSensorForce();
  53.  getGyro();
  54.  getSlider();
  55.  
  56. }
  57. void printWifiData() {
  58.   // print your WiFi shield's IP address:
  59.   IPAddress ip = WiFi.localIP();
  60.     Serial.print("IP Address: ");
  61.   Serial.println(ip);
  62.   Serial.println(ip);
  63.  
  64.   // print your MAC address:
  65.   byte mac[6];  
  66.   WiFi.macAddress(mac);
  67.   Serial.print("MAC address: ");
  68.   Serial.print(mac[5],HEX);
  69.   Serial.print(":");
  70.   Serial.print(mac[4],HEX);
  71.   Serial.print(":");
  72.   Serial.print(mac[3],HEX);
  73.   Serial.print(":");
  74.   Serial.print(mac[2],HEX);
  75.   Serial.print(":");
  76.   Serial.print(mac[1],HEX);
  77.   Serial.print(":");
  78.   Serial.println(mac[0],HEX);
  79.  
  80. }
  81.  
  82. void printCurrentNet() {
  83.   // print the SSID of the network you're attached to:
  84.   Serial.print("SSID: ");
  85.   Serial.println(WiFi.SSID());
  86.  
  87.   // print the MAC address of the router you're attached to:
  88.   byte bssid[6];
  89.   WiFi.BSSID(bssid);    
  90.   Serial.print("BSSID: ");
  91.   Serial.print(bssid[5],HEX);
  92.   Serial.print(":");
  93.   Serial.print(bssid[4],HEX);
  94.   Serial.print(":");
  95.   Serial.print(bssid[3],HEX);
  96.   Serial.print(":");
  97.   Serial.print(bssid[2],HEX);
  98.   Serial.print(":");
  99.   Serial.print(bssid[1],HEX);
  100.   Serial.print(":");
  101.   Serial.println(bssid[0],HEX);
  102.  
  103.   // print the received signal strength:
  104.   long rssi = WiFi.RSSI();
  105.   Serial.print("signal strength (RSSI):");
  106.   Serial.println(rssi);
  107.  
  108.   // print the encryption type:
  109.   byte encryption = WiFi.encryptionType();
  110.   Serial.print("Encryption Type:");
  111.   Serial.println(encryption,HEX);
  112.   Serial.println();
  113. }
  114. void getSensorForce(){
  115. sensorForceData[1] = analogRead(1);
  116. sensorForceData[2] = analogRead(2);
  117. sensorForceData[3] = analogRead(3);
  118. sensorForceData[4] = analogRead(4);
  119. sensorForceData[5] = analogRead(5);
  120. sensorForceData[7] = analogRead(7);
  121. sensorForceData[8] = analogRead(8);
  122. sensorForceData[9] = analogRead(9);
  123.  
  124. }
  125.  
  126. void getGyro(){
  127. gyroX = analogRead(10);
  128. gyroY = analogRead(11);
  129. gyroZ = analogRead(12);
  130.  
  131. }
  132.  
  133. void getSlider(){
  134. sliderG = analogRead(14);
  135. sliderD = analogRead(15);
  136.  
  137. }
  138.  
  139.  
  140. void init(){
  141.  
  142.   int i=0;
  143.   for (i=0; i++; i< 10)
  144.   {
  145.     sensorForceData[i] = 0;
  146.   }
  147.     gyroX = 0;
  148.     gyroY = 0;
  149.     gyroZ = 0;
  150.    
  151.    sliderG = 0;
  152.    sliderD = 0;
  153.  
  154. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top