Components and supplies
Arduino UNO
Apps and platforms
Maker service
Project description
Code
Laundry Machine to IFTTT
arduino
Monitors laundry machines through discarded (or new) Wii Nunchucks. Automatically starts, monitors the cycle then fires an IFTTT event when complete.
1#include <Dhcp.h> 2#include <Dns.h> 3#include <Ethernet.h> 4#include <EthernetClient.h> 5#include <EthernetServer.h> 6#include <EthernetUdp.h> 7#include <Wire.h> 8#include <ArduinoNunchuk.h> 9/* 10 Washing Machine Control 11 Copyright 2016 Dan Van Fleet http://danvanfleet.com 12 13 Project URL: None Yet 14 Monitor machine for movement to automatically start, monitor cycle, send IFTTT event at end of cycle. 15 Uses Wii Nunchuck for motion and buttons as manual start and cancel buttons. 16*/ 17const bool isWasherOrDryer = false ; // true for washer, false for Dryer 18const bool isTestMode = false; // true won't fire IFTTT integration 19const int isFastMode = 1; // used for testing divides timers by entered value. 0 or 1 runs normal time. 20 21const String washerIftttEventName = "WasherDone"; 22const String dryerIftttEventName = "DryerDone"; 23const String iftttKey = "PutYourIFtttKeyHere"; 24const char server[] = "maker.ifttt.com"; 25 26byte dryerMac[] = { 0xDA, 0xAD, 0xBE, 0xEF, 0xFE, 0xEE }; 27byte washerMac[] = { 0xDA, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; 28const IPAddress dryerIP(192, 168, 16, 177); // Set the static IP address to use if the DHCP fails to assign 29const IPAddress washerIP(192, 168, 16, 178); // Set the static IP address to use if the DHCP fails to assign 30 31/* 32 33 These settings are for a Front Loading Kenmore Elite washer and dryer sitting on a drawer on concrete. 34 The dryer is rather a consistent vibration, and significantly larger than the washer other than spin cycle. 35 The washer stops for a fairly long period of time and has a high RunWaitTime in comparison. 36 DryerAutostartMovement time should be longer than Washer Spin cycle. 37 Washer AutoStart could be set fairly high to startup during the wash spin cycle rather than close to initial startup. 38*/ 39 40const int washerRunSensitivity = 4; // movement sensitivity, lower more sensitive 1 - 255 41const float washerRunWaitTime = 4.1; // minutes set to maximum no movement time during a run, at the end the event is fired. 42 43const int washerAutoStartSensitivity = 3; //movement sensitivity for automatic start, can be set big to get caught by first spin cycle 44const float washerAutoStartMovementTime = 60; // Seconds movement required before auto start 45const int washerAutoStartThreshold = 250; // skips # of not breaking sensitivity allowed during autostart 46 47const int dryerRunSensitivity = 6; // movement sensitivity, lower more sensitive 1 - 255 48const float dryerRunWaitTime = 0.5; // minutes set to maximum no movement time during a run, at the end the event is fired. 49 50const int dryerAutoStartSensitivity = 4; //movement sensitivity for automatic start 51const float dryerAutoStartMovementTime = 480; // Seconds movement required before auto start, needs to be longer than washer's fast spin cycle 52const int dryerAutoStartThreshold = 85; // skips # of loops reading lower than sensitivity allowed during autostart 53 54const int pinRun = 4; // Pin Run LED is connected to Green. Illumiate 50% during run, 100% during ifttt send. 55const int pinAutoStartCheck = 7; // Pin AutoStart in progress LED Blue. Illuminates at 50% of AutoStartMovementTime. Flashes at initial power up, after post. 56const int pinEndCycleCheck = 6; // Pin End Cycle check LED Red. Illuminates at 10% of RunWaitTime. 57const int pinAutoStarted = 5; //Pin cycle was autostarted LED Yellow. Illuminates when autostart detected. 58 59const int timerAdjustment = 5000; // loops per minute 60const int BAUDRATE = 19200; 61// End Setup items 62 63ArduinoNunchuk nunchuk = ArduinoNunchuk(); 64bool isRunning = false; // program contol 65float lastAccelX = 0; // stores last positions for delta determinations. 66float lastAccelY = 0; // '' 67float lastAccelZ = 0; // '' 68int counter = 0; // stores counter position for run loop counter 69float startMoveCounter = 0; // stores counter position for auto start cycle loops 70int lastChangeCount = 0; // stores counter position of last seen change 71// these come from washer or dryer settings. 72int runSensitivity = 0; // stores minimum movement value to continuing running. 73float runWaitTime = 0; // stores maximum no movement time in seconds before run ends 74int autoStartSensitivity = 0; // stores minimum value to consider starting 75float autoStartMovementTime = 0; // stores seconds of start movement before auto start 76int autoStartThreshold = 0; // stores maximum no movement loops to ignore during auto start check. 77String iftttEventName = ""; // stores ifttt event name to run 78byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // placeholder for mac address 79IPAddress ip(192, 168, 16, 175); // place holder for IP address //end washer or dryer settings 80int logX = 0; // Used for Display 81int logY = 0; 82int logZ = 0; 83int countWrap = 0; 84int displayWrap = 0; // end Display 85EthernetClient client; // used to talk 86 87void setup() 88{ 89 pinMode(pinRun, OUTPUT); 90 pinMode(pinAutoStartCheck, OUTPUT); 91 pinMode(pinEndCycleCheck, OUTPUT); 92 pinMode(pinAutoStarted, OUTPUT); 93 digitalWrite(pinRun, LOW); 94 digitalWrite(pinAutoStartCheck, HIGH); 95 digitalWrite(pinEndCycleCheck, LOW); 96 digitalWrite(pinAutoStarted, LOW); 97 Serial.begin(BAUDRATE); 98 while (!Serial) { 99 ; // wait for serial port to connect. Needed for native USB port only 100 } 101 nunchuk.init(); 102 103 if (isWasherOrDryer) // toggle in variables 104 { 105 runSensitivity = washerRunSensitivity; 106 runWaitTime = washerRunWaitTime; 107 autoStartSensitivity = washerAutoStartSensitivity; 108 autoStartMovementTime = washerAutoStartMovementTime; 109 autoStartThreshold = washerAutoStartThreshold; 110 iftttEventName = washerIftttEventName; 111 memcpy(mac,washerMac, 6); 112 memcpy(ip, washerIP, 4); 113 } 114 else 115 { 116 runSensitivity = dryerRunSensitivity; 117 runWaitTime = dryerRunWaitTime; 118 autoStartSensitivity = dryerAutoStartSensitivity; 119 autoStartMovementTime = dryerAutoStartMovementTime; 120 autoStartThreshold = dryerAutoStartThreshold; 121 iftttEventName = dryerIftttEventName; 122 memcpy(mac, dryerMac, 6); 123 memcpy(ip, dryerIP, 4); 124 } 125 if (isFastMode > 1) { 126 runWaitTime = runWaitTime / isFastMode; 127 autoStartMovementTime = autoStartMovementTime / isFastMode; 128 } 129} 130void loop() 131{ 132 // if there are incoming bytes available 133 // from the ifttt server, read and print them: 134 if (client.available()) { 135 digitalWrite(pinAutoStartCheck, LOW); 136 char c = client.read(); 137 Serial.print(c); 138 } 139 else { 140 nunchuk.update(); 141 CheckButtons(); 142 if (isRunning == true) 143 { 144 digitalWrite(pinAutoStartCheck, LOW); 145 digitalWrite(pinRun, HIGH); 146 if (counter < (runWaitTime * timerAdjustment)) { RunMovementInspector(); digitalWrite(pinRun, LOW); // keeps LED dimmer so that when ifttt call is being setup and made it gets brighter. 147 { 148 // Movement detected 149 counter = 0; 150 digitalWrite(pinEndCycleCheck, LOW); 151 } 152 else 153 { 154 //Not moving, should we get out? 155 counter++; 156 if (counter > runWaitTime * timerAdjustment / 10) 157 { // Light the considering stop light at 158 digitalWrite(pinEndCycleCheck, HIGH); 159 } 160 } 161 PrintLog(counter, changeX, changeY, changeZ); 162 163} 164 165int GetChangeX(){ 166 float accel = nunchuk.accelX; 167 float change = lastAccelX - accel; 168 lastAccelX = accel; 169 return abs(change); 170} 171int GetChangeY(){ 172 float accel = nunchuk.accelY; 173 float change = lastAccelY - accel; 174 lastAccelY = accel; 175 return abs(change); 176} 177int GetChangeZ(){ 178 float accel = nunchuk.accelZ; 179 float change = lastAccelZ - accel; 180 lastAccelZ = accel; 181 return abs(change); 182} 183void StartupCheck() 184{ 185 float changeX, changeY, changeZ; 186 changeX = GetChangeX(); 187 changeY = GetChangeY(); 188 changeZ = GetChangeZ(); 189 if ( changeX > autoStartSensitivity || abs(changeY) > autoStartSensitivity || abs(changeZ) > autoStartSensitivity ) 190 { // Something moved more than it should have, count it. 191 startMoveCounter++; 192 lastChangeCount = startMoveCounter; 193 StartupLog(startMoveCounter, changeX, changeY, changeZ); 194 if (startMoveCounter > (autoStartMovementTime * timerAdjustment / 120)) { 195 digitalWrite(pinAutoStartCheck, HIGH); // if we hit half way point light the led. 196 } 197 } 198 else 199 { 200 if (startMoveCounter - lastChangeCount > autoStartThreshold) { 201 //too many counts since change detected, reset counters 202 startMoveCounter = 0; 203 lastChangeCount = 0; 204 digitalWrite(pinAutoStartCheck, LOW); 205 Serial.println("Reset Counters"); 206 } else 207 { 208 startMoveCounter++; 209 Serial.println(startMoveCounter, 0); // we didn't move, print a line 210 } 211 } 212 if (startMoveCounter > (autoStartMovementTime * timerAdjustment / 60 )) //autoStartMovementTime is in Seconds. 213 { 214 isRunning = true; 215 digitalWrite(pinRun, HIGH); 216 digitalWrite(pinAutoStarted, HIGH); 217 startMoveCounter = 0; 218 } 219} 220void SendAlert() 221{ 222 // start the Ethernet connection: 223 Serial.println("starting"); 224 if (Ethernet.begin(mac) == 0) { 225 Serial.println("Failed to configure Ethernet using DHCP"); 226 // try to congifure using IP address instead of DHCP: 227 Ethernet.begin(mac, ip); 228 } 229 // give the Ethernet shield a second to initialize: 230 delay(1000); 231 232 Serial.println("connecting..."); 233 if (client.connect(server, 80)) { 234 Serial.println("connected"); 235 //Make a HTTP request: 236 client.println("GET /trigger/" + iftttEventName + "/with/key/" + iftttKey + " HTTP/1.1"); 237 client.println("Host: maker.ifttt.com"); 238 client.println("Connection: close"); 239 client.println(); 240 } 241 else //client.connect 242 { 243 // if you didn't get a connection to the server: 244 Serial.println("connection failed"); 245 } 246} 247void PrintLog(int counter, int changeX, int changeY, int changeZ) 248{ 249 int summary = 99; // 83 is closer to a second 100 is easier to read 250 displayWrap++; 251 // Display largest change over summary movements 252 if (countWrap < summary) { 253 if (logX < changeX) { 254 logX = changeX; 255 } 256 if (logY < changeY) { 257 logY += changeY; 258 } 259 if (logZ < changeZ) { logZ += changeZ; } countWrap++; } else { Serial.print(counter); Serial.print("-"); Serial.print(logX); Serial.print(" "); Serial.print(logY); Serial.print(" "); if (displayWrap > (summary * 10)) { 260 Serial.println(logZ); 261 displayWrap = 0; 262 } 263 else 264 { 265 Serial.print(logZ); 266 Serial.print(" "); 267 } 268 countWrap = 0; 269 logX = 0; 270 logY = 0; 271 logZ = 0; 272 } 273} 274void StartupLog(int startMoveCounter, int x,int y,int z){ 275 //we are moving, wrap every 15. 276 displayWrap++; 277 Serial.print(startMoveCounter); 278 //Serial.print("-"); 279 //Serial.print(x); 280 //Serial.print(" "); 281 //Serial.print(y); 282 //Serial.print(" "); 283 //Serial.print(z); 284 //Serial.print(" "); 285 if (displayWrap > 15) { 286 Serial.println(" "); 287 displayWrap = 0; 288 } 289 else { 290 Serial.print(" "); 291 } 292}
Laundry Machine to IFTTT
arduino
Monitors laundry machines through discarded (or new) Wii Nunchucks. Automatically starts, monitors the cycle then fires an IFTTT event when complete.
1#include <Dhcp.h> 2#include <Dns.h> 3#include <Ethernet.h> 4#include 5 <EthernetClient.h> 6#include <EthernetServer.h> 7#include <EthernetUdp.h> 8#include 9 <Wire.h> 10#include <ArduinoNunchuk.h> 11/* 12 Washing Machine Control 13 Copyright 14 2016 Dan Van Fleet http://danvanfleet.com 15 16 Project URL: None Yet 17 Monitor 18 machine for movement to automatically start, monitor cycle, send IFTTT event at 19 end of cycle. 20 Uses Wii Nunchuck for motion and buttons as manual start and 21 cancel buttons. 22*/ 23const bool isWasherOrDryer = false ; // true for washer, 24 false for Dryer 25const bool isTestMode = false; // true won't fire IFTTT integration 26const 27 int isFastMode = 1; // used for testing divides timers by entered value. 0 or 1 28 runs normal time. 29 30const String washerIftttEventName = "WasherDone"; 31const 32 String dryerIftttEventName = "DryerDone"; 33const String iftttKey = "PutYourIFtttKeyHere"; 34const 35 char server[] = "maker.ifttt.com"; 36 37byte dryerMac[] = { 0xDA, 0xAD, 0xBE, 38 0xEF, 0xFE, 0xEE }; 39byte washerMac[] = { 0xDA, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; 40const 41 IPAddress dryerIP(192, 168, 16, 177); // Set the static IP address to use if the 42 DHCP fails to assign 43const IPAddress washerIP(192, 168, 16, 178); // Set the 44 static IP address to use if the DHCP fails to assign 45 46/* 47 48 These 49 settings are for a Front Loading Kenmore Elite washer and dryer sitting on a drawer 50 on concrete. 51 The dryer is rather a consistent vibration, and significantly 52 larger than the washer other than spin cycle. 53 The washer stops for a fairly 54 long period of time and has a high RunWaitTime in comparison. 55 DryerAutostartMovement 56 time should be longer than Washer Spin cycle. 57 Washer AutoStart could be set 58 fairly high to startup during the wash spin cycle rather than close to initial startup. 59*/ 60 61 62const int washerRunSensitivity = 4; // movement sensitivity, lower more sensitive 63 1 - 255 64const float washerRunWaitTime = 4.1; // minutes set to maximum no movement 65 time during a run, at the end the event is fired. 66 67const int washerAutoStartSensitivity 68 = 3; //movement sensitivity for automatic start, can be set big to get caught by 69 first spin cycle 70const float washerAutoStartMovementTime = 60; // Seconds movement 71 required before auto start 72const int washerAutoStartThreshold = 250; // skips 73 # of not breaking sensitivity allowed during autostart 74 75const int dryerRunSensitivity 76 = 6; // movement sensitivity, lower more sensitive 1 - 255 77const float dryerRunWaitTime 78 = 0.5; // minutes set to maximum no movement time during a run, at the end the 79 event is fired. 80 81const int dryerAutoStartSensitivity = 4; //movement sensitivity 82 for automatic start 83const float dryerAutoStartMovementTime = 480; // Seconds 84 movement required before auto start, needs to be longer than washer's fast spin 85 cycle 86const int dryerAutoStartThreshold = 85; // skips # of loops reading lower 87 than sensitivity allowed during autostart 88 89const int pinRun = 4; // Pin 90 Run LED is connected to Green. Illumiate 50% during run, 100% during ifttt send. 91const 92 int pinAutoStartCheck = 7; // Pin AutoStart in progress LED Blue. Illuminates at 93 50% of AutoStartMovementTime. Flashes at initial power up, after post. 94const 95 int pinEndCycleCheck = 6; // Pin End Cycle check LED Red. Illuminates at 10% of 96 RunWaitTime. 97const int pinAutoStarted = 5; //Pin cycle was autostarted LED Yellow. 98 Illuminates when autostart detected. 99 100const int timerAdjustment = 5000; // 101 loops per minute 102const int BAUDRATE = 19200; 103// End Setup items 104 105ArduinoNunchuk 106 nunchuk = ArduinoNunchuk(); 107bool isRunning = false; // program contol 108float 109 lastAccelX = 0; // stores last positions for delta determinations. 110float lastAccelY 111 = 0; // '' 112float lastAccelZ = 0; // '' 113int counter = 0; // stores counter 114 position for run loop counter 115float startMoveCounter = 0; // stores counter 116 position for auto start cycle loops 117int lastChangeCount = 0; // stores counter 118 position of last seen change 119// these come from washer or dryer settings. 120int 121 runSensitivity = 0; // stores minimum movement value to continuing running. 122float 123 runWaitTime = 0; // stores maximum no movement time in seconds before run ends 124int 125 autoStartSensitivity = 0; // stores minimum value to consider starting 126float 127 autoStartMovementTime = 0; // stores seconds of start movement before auto start 128int 129 autoStartThreshold = 0; // stores maximum no movement loops to ignore during auto 130 start check. 131String iftttEventName = ""; // stores ifttt event name to run 132byte 133 mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // placeholder for mac address 134IPAddress 135 ip(192, 168, 16, 175); // place holder for IP address //end washer or dryer settings 136int 137 logX = 0; // Used for Display 138int logY = 0; 139int logZ = 0; 140int countWrap 141 = 0; 142int displayWrap = 0; // end Display 143EthernetClient client; // used to 144 talk 145 146void setup() 147{ 148 pinMode(pinRun, OUTPUT); 149 pinMode(pinAutoStartCheck, 150 OUTPUT); 151 pinMode(pinEndCycleCheck, OUTPUT); 152 pinMode(pinAutoStarted, OUTPUT); 153 154 digitalWrite(pinRun, LOW); 155 digitalWrite(pinAutoStartCheck, HIGH); 156 digitalWrite(pinEndCycleCheck, 157 LOW); 158 digitalWrite(pinAutoStarted, LOW); 159 Serial.begin(BAUDRATE); 160 while 161 (!Serial) { 162 ; // wait for serial port to connect. Needed for native USB port 163 only 164 } 165 nunchuk.init(); 166 167 if (isWasherOrDryer) // toggle in variables 168 169 { 170 runSensitivity = washerRunSensitivity; 171 runWaitTime = washerRunWaitTime; 172 173 autoStartSensitivity = washerAutoStartSensitivity; 174 autoStartMovementTime 175 = washerAutoStartMovementTime; 176 autoStartThreshold = washerAutoStartThreshold; 177 178 iftttEventName = washerIftttEventName; 179 memcpy(mac,washerMac, 6); 180 181 memcpy(ip, washerIP, 4); 182 } 183 else 184 { 185 runSensitivity = dryerRunSensitivity; 186 187 runWaitTime = dryerRunWaitTime; 188 autoStartSensitivity = dryerAutoStartSensitivity; 189 190 autoStartMovementTime = dryerAutoStartMovementTime; 191 autoStartThreshold 192 = dryerAutoStartThreshold; 193 iftttEventName = dryerIftttEventName; 194 memcpy(mac, 195 dryerMac, 6); 196 memcpy(ip, dryerIP, 4); 197 } 198 if (isFastMode > 1) 199 { 200 runWaitTime = runWaitTime / isFastMode; 201 autoStartMovementTime = 202 autoStartMovementTime / isFastMode; 203 } 204} 205void loop() 206{ 207 // if there 208 are incoming bytes available 209 // from the ifttt server, read and print them: 210 211 if (client.available()) { 212 digitalWrite(pinAutoStartCheck, LOW); 213 char 214 c = client.read(); 215 Serial.print(c); 216 } 217 else { 218 nunchuk.update(); 219 220 CheckButtons(); 221 if (isRunning == true) 222 { 223 digitalWrite(pinAutoStartCheck, 224 LOW); 225 digitalWrite(pinRun, HIGH); 226 if (counter < (runWaitTime * 227 timerAdjustment)) { RunMovementInspector(); digitalWrite(pinRun, LOW); // keeps 228 LED dimmer so that when ifttt call is being setup and made it gets brighter. 229 230 { 231 // Movement detected 232 counter = 0; 233 digitalWrite(pinEndCycleCheck, 234 LOW); 235 } 236 else 237 { 238 //Not moving, should we get out? 239 counter++; 240 241 if (counter > runWaitTime * timerAdjustment / 10) 242 { // Light the considering 243 stop light at 244 digitalWrite(pinEndCycleCheck, HIGH); 245 } 246 } 247 248 PrintLog(counter, changeX, changeY, changeZ); 249 250} 251 252int GetChangeX(){ 253 254 float accel = nunchuk.accelX; 255 float change = lastAccelX - accel; 256 lastAccelX 257 = accel; 258 return abs(change); 259} 260int GetChangeY(){ 261 float accel = nunchuk.accelY; 262 263 float change = lastAccelY - accel; 264 lastAccelY = accel; 265 return abs(change); 266} 267int 268 GetChangeZ(){ 269 float accel = nunchuk.accelZ; 270 float change = lastAccelZ 271 - accel; 272 lastAccelZ = accel; 273 return abs(change); 274} 275void StartupCheck() 276{ 277 278 float changeX, changeY, changeZ; 279 changeX = GetChangeX(); 280 changeY = GetChangeY(); 281 282 changeZ = GetChangeZ(); 283 if ( changeX > autoStartSensitivity || abs(changeY) 284 > autoStartSensitivity || abs(changeZ) > autoStartSensitivity ) 285 { // Something 286 moved more than it should have, count it. 287 startMoveCounter++; 288 lastChangeCount 289 = startMoveCounter; 290 StartupLog(startMoveCounter, changeX, changeY, changeZ); 291 292 if (startMoveCounter > (autoStartMovementTime * timerAdjustment / 120)) 293 { 294 digitalWrite(pinAutoStartCheck, HIGH); // if we hit half way point light 295 the led. 296 } 297 } 298 else 299 { 300 if (startMoveCounter - lastChangeCount 301 > autoStartThreshold) { 302 //too many counts since change detected, reset 303 counters 304 startMoveCounter = 0; 305 lastChangeCount = 0; 306 digitalWrite(pinAutoStartCheck, 307 LOW); 308 Serial.println("Reset Counters"); 309 } else 310 { 311 startMoveCounter++; 312 313 Serial.println(startMoveCounter, 0); // we didn't move, print a line 314 315 } 316 } 317 if (startMoveCounter > (autoStartMovementTime * timerAdjustment 318 / 60 )) //autoStartMovementTime is in Seconds. 319 { 320 isRunning = true; 321 322 digitalWrite(pinRun, HIGH); 323 digitalWrite(pinAutoStarted, HIGH); 324 startMoveCounter 325 = 0; 326 } 327} 328void SendAlert() 329{ 330 // start the Ethernet connection: 331 332 Serial.println("starting"); 333 if (Ethernet.begin(mac) == 0) { 334 Serial.println("Failed 335 to configure Ethernet using DHCP"); 336 // try to congifure using IP address 337 instead of DHCP: 338 Ethernet.begin(mac, ip); 339 } 340 // give the Ethernet 341 shield a second to initialize: 342 delay(1000); 343 344 Serial.println("connecting..."); 345 346 if (client.connect(server, 80)) { 347 Serial.println("connected"); 348 //Make 349 a HTTP request: 350 client.println("GET /trigger/" + iftttEventName + "/with/key/" 351 + iftttKey + " HTTP/1.1"); 352 client.println("Host: maker.ifttt.com"); 353 354 client.println("Connection: close"); 355 client.println(); 356 } 357 else 358 //client.connect 359 { 360 // if you didn't get a connection to the server: 361 362 Serial.println("connection failed"); 363 } 364} 365void PrintLog(int counter, 366 int changeX, int changeY, int changeZ) 367{ 368 int summary = 99; // 83 is closer 369 to a second 100 is easier to read 370 displayWrap++; 371 // Display largest change 372 over summary movements 373 if (countWrap < summary) { 374 if (logX < changeX) 375 { 376 logX = changeX; 377 } 378 if (logY < changeY) { 379 logY += 380 changeY; 381 } 382 if (logZ < changeZ) { logZ += changeZ; } countWrap++; } 383 else { Serial.print(counter); Serial.print("-"); Serial.print(logX); Serial.print(" 384 "); Serial.print(logY); Serial.print(" "); if (displayWrap > (summary * 10)) 385 { 386 Serial.println(logZ); 387 displayWrap = 0; 388 } 389 else 390 391 { 392 Serial.print(logZ); 393 Serial.print(" "); 394 } 395 396 countWrap = 0; 397 logX = 0; 398 logY = 0; 399 logZ = 0; 400 } 401} 402void 403 StartupLog(int startMoveCounter, int x,int y,int z){ 404 //we are moving, wrap 405 every 15. 406 displayWrap++; 407 Serial.print(startMoveCounter); 408 409 //Serial.print("-"); 410 //Serial.print(x); 411 //Serial.print(" "); 412 413 //Serial.print(y); 414 //Serial.print(" "); 415 //Serial.print(z); 416 417 //Serial.print(" "); 418 if (displayWrap > 15) { 419 Serial.println(" 420 "); 421 displayWrap = 0; 422 } 423 else { 424 Serial.print(" 425 "); 426 } 427}
Downloadable files
Wire connections
Wii nunchuck supplies both motion detection and hookup for buttons.
Wire connections
Wire connections
Wii nunchuck supplies both motion detection and hookup for buttons.
Wire connections
Documentation
Completed Build
The completed device installed in a case
Completed Build
Comments
Only logged in users can leave comments
danvanf
0 Followers
•0 Projects
+1
Work attribution
Table of contents
Intro
3
0