-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added CC BY-NC-SA 4.0 attribution, comments / disclaimers, and some minor code cleanup.
- Loading branch information
1 parent
9f045f9
commit cf42c42
Showing
7 changed files
with
212 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
/* | ||
* (CC BY-NC-SA 4.0) | ||
* http://creativecommons.org/licenses/by-nc-sa/4.0/ | ||
* | ||
* WARNING WARNING WARNING: attaching motors to a skateboard is | ||
* a terribly dangerous thing to do. This software is totally | ||
* for amusement and/or educational purposes. Don't obtain or | ||
* make a wiiceiver (see below for instructions and parts), | ||
* don't attach it to a skateboard, and CERTAINLY don't use it | ||
* to zip around with just a tiny, ergonomic nunchuck instead | ||
* of a bulky R/C controller. | ||
* | ||
* This software is made freely available. If you wish to | ||
* sell it, don't. If you wish to modify it, DO! (and please | ||
* let me know). Much of the code is derived from others out | ||
* there, I've made attributuions where appropriate. | ||
* | ||
* http://austindavid.com/wiiceiver | ||
* | ||
* latest software: https://github.com/jaustindavid/wiiceiver | ||
* schematic & parts: http://www.digikey.com/schemeit#t9g | ||
* | ||
* Enjoy! Be safe! | ||
* | ||
* (CC BY-NC-SA 4.0) Austin David, [email protected] | ||
* 12 May 2014 | ||
* | ||
*/ | ||
|
||
#ifndef BLINKER_H | ||
#define BLINKER_H | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
/* | ||
* (CC BY-NC-SA 4.0) | ||
* http://creativecommons.org/licenses/by-nc-sa/4.0/ | ||
* | ||
* WARNING WARNING WARNING: attaching motors to a skateboard is | ||
* a terribly dangerous thing to do. This software is totally | ||
* for amusement and/or educational purposes. Don't obtain or | ||
* make a wiiceiver (see below for instructions and parts), | ||
* don't attach it to a skateboard, and CERTAINLY don't use it | ||
* to zip around with just a tiny, ergonomic nunchuck instead | ||
* of a bulky R/C controller. | ||
* | ||
* This software is made freely available. If you wish to | ||
* sell it, don't. If you wish to modify it, DO! (and please | ||
* let me know). Much of the code is derived from others out | ||
* there, I've made attributuions where appropriate. | ||
* | ||
* http://austindavid.com/wiiceiver | ||
* | ||
* latest software: https://github.com/jaustindavid/wiiceiver | ||
* schematic & parts: http://www.digikey.com/schemeit#t9g | ||
* | ||
* Enjoy! Be safe! | ||
* | ||
* (CC BY-NC-SA 4.0) Austin David, [email protected] | ||
* 12 May 2014 | ||
* | ||
*/ | ||
|
||
#ifndef CHUCK_H | ||
#define CHUCK_H | ||
|
||
|
@@ -147,7 +176,7 @@ class Chuck { | |
void readEEPROM() { | ||
byte storedY; | ||
|
||
storedY = EEPROM.read(0); | ||
storedY = EEPROM.read(EEPROM_Y_ADDY); | ||
#ifdef DEBUGGING_CHUCK | ||
Serial.print(F("Reading stored value: Y=")); | ||
Serial.println(storedY); | ||
|
@@ -169,7 +198,7 @@ class Chuck { | |
|
||
|
||
void writeEEPROM() { | ||
EEPROM.write(0, Y0); | ||
EEPROM.write(EEPROM_Y_ADDY, Y0); | ||
#ifdef DEBUGGING_CHUCK | ||
Serial.print("Storing value: Y="); | ||
Serial.println(Y0); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
/* | ||
* (CC BY-NC-SA 4.0) | ||
* http://creativecommons.org/licenses/by-nc-sa/4.0/ | ||
* | ||
* WARNING WARNING WARNING: attaching motors to a skateboard is | ||
* a terribly dangerous thing to do. This software is totally | ||
* for amusement and/or educational purposes. Don't obtain or | ||
* make a wiiceiver (see below for instructions and parts), | ||
* don't attach it to a skateboard, and CERTAINLY don't use it | ||
* to zip around with just a tiny, ergonomic nunchuck instead | ||
* of a bulky R/C controller. | ||
* | ||
* This software is made freely available. If you wish to | ||
* sell it, don't. If you wish to modify it, DO! (and please | ||
* let me know). Much of the code is derived from others out | ||
* there, I've made attributuions where appropriate. | ||
* | ||
* http://austindavid.com/wiiceiver | ||
* | ||
* latest software: https://github.com/jaustindavid/wiiceiver | ||
* schematic & parts: http://www.digikey.com/schemeit#t9g | ||
* | ||
* Enjoy! Be safe! | ||
* | ||
* (CC BY-NC-SA 4.0) Austin David, [email protected] | ||
* 12 May 2014 | ||
* | ||
*/ | ||
|
||
#ifndef ELECTRONICSPEEDCONTROLLER_H | ||
#define ELECTRONICSPEEDCONTROLLER_H | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
/* | ||
* (CC BY-NC-SA 4.0) | ||
* http://creativecommons.org/licenses/by-nc-sa/4.0/ | ||
* | ||
* WARNING WARNING WARNING: attaching motors to a skateboard is | ||
* a terribly dangerous thing to do. This software is totally | ||
* for amusement and/or educational purposes. Don't obtain or | ||
* make a wiiceiver (see below for instructions and parts), | ||
* don't attach it to a skateboard, and CERTAINLY don't use it | ||
* to zip around with just a tiny, ergonomic nunchuck instead | ||
* of a bulky R/C controller. | ||
* | ||
* This software is made freely available. If you wish to | ||
* sell it, don't. If you wish to modify it, DO! (and please | ||
* let me know). Much of the code is derived from others out | ||
* there, I've made attributuions where appropriate. | ||
* | ||
* http://austindavid.com/wiiceiver | ||
* | ||
* latest software: https://github.com/jaustindavid/wiiceiver | ||
* schematic & parts: http://www.digikey.com/schemeit#t9g | ||
* | ||
* Enjoy! Be safe! | ||
* | ||
* (CC BY-NC-SA 4.0) Austin David, [email protected] | ||
* 12 May 2014 | ||
* | ||
*/ | ||
|
||
#ifndef SMOOTHER_H | ||
#define SMOOTHER_H | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
/* | ||
* (CC BY-NC-SA 4.0) | ||
* http://creativecommons.org/licenses/by-nc-sa/4.0/ | ||
* | ||
* WARNING WARNING WARNING: attaching motors to a skateboard is | ||
* a terribly dangerous thing to do. This software is totally | ||
* for amusement and/or educational purposes. Don't obtain or | ||
* make a wiiceiver (see below for instructions and parts), | ||
* don't attach it to a skateboard, and CERTAINLY don't use it | ||
* to zip around with just a tiny, ergonomic nunchuck instead | ||
* of a bulky R/C controller. | ||
* | ||
* This software is made freely available. If you wish to | ||
* sell it, don't. If you wish to modify it, DO! (and please | ||
* let me know). Much of the code is derived from others out | ||
* there, I've made attributuions where appropriate. | ||
* | ||
* http://austindavid.com/wiiceiver | ||
* | ||
* latest software: https://github.com/jaustindavid/wiiceiver | ||
* schematic & parts: http://www.digikey.com/schemeit#t9g | ||
* | ||
* Enjoy! Be safe! | ||
* | ||
* (CC BY-NC-SA 4.0) Austin David, [email protected] | ||
* 12 May 2014 | ||
* | ||
*/ | ||
|
||
#ifndef THROTTLE_H | ||
#define THROTTLE_H | ||
|
||
|
@@ -87,31 +116,16 @@ class Throttle { | |
#endif | ||
|
||
if (checkAutoCruise(chuck)) { | ||
return throttle; // we're looking for autoCruise, so do that -- don't change the throttle | ||
return throttle; // we're looking for autoCruise, so do that; | ||
// don't change the throttle position | ||
} | ||
|
||
if (chuck.C) { // cruise control! | ||
/* | ||
#ifdef DEBUGGING_THROTTLE | ||
Serial.print("CC: last = "); | ||
Serial.print(throttle, 4); | ||
Serial.print(", "); | ||
#endif | ||
if (throttle < autoCruise) { | ||
throttle += THROTTLE_CC_BUMP * 1.5; | ||
} else { | ||
if (chuck.Y > 0.5 && throttle < 1.0) { | ||
throttle += THROTTLE_CC_BUMP * (chuck.Z ? 2 : 1); | ||
} else if (chuck.Y < -0.5 && throttle > -1.0) { | ||
throttle -= THROTTLE_CC_BUMP * (chuck.Z ? 2 : 1); | ||
} // if (chuck.Y > 0.5 && throttle < 1.0) - else | ||
} // if (throttle < THROTTLE_MIN_CC) - else | ||
*/ | ||
|
||
if (chuck.Y > 0.5 && throttle < 1.0) { | ||
throttle += THROTTLE_CC_BUMP * (chuck.Z ? 2 : 1); | ||
} else { | ||
if (chuck.Y < -0.5 && throttle > -1.0) { | ||
if (chuck.Y < -0.5 && throttle > 0) { | ||
throttle -= THROTTLE_CC_BUMP * (chuck.Z ? 2 : 1); | ||
} else { | ||
if (throttle < autoCruise) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,36 @@ | ||
/* | ||
* (CC BY-NC-SA 4.0) | ||
* http://creativecommons.org/licenses/by-nc-sa/4.0/ | ||
* | ||
* WARNING WARNING WARNING: attaching motors to a skateboard is | ||
* a terribly dangerous thing to do. This software is totally | ||
* for amusement and/or educational purposes. Don't obtain or | ||
* make a wiiceiver (see below for instructions and parts), | ||
* don't attach it to a skateboard, and CERTAINLY don't use it | ||
* to zip around with just a tiny, ergonomic nunchuck instead | ||
* of a bulky R/C controller. | ||
* | ||
* This software is made freely available. If you wish to | ||
* sell it, don't. If you wish to modify it, DO! (and please | ||
* let me know). Much of the code is derived from others out | ||
* there, I've made attributuions where appropriate. | ||
* | ||
* http://austindavid.com/wiiceiver | ||
* | ||
* latest software: https://github.com/jaustindavid/wiiceiver | ||
* schematic & parts: http://www.digikey.com/schemeit#t9g | ||
* | ||
* Enjoy! Be safe! | ||
* | ||
* (CC BY-NC-SA 4.0) Austin David, [email protected] | ||
* 12 May 2014 | ||
* | ||
*/ | ||
|
||
#include <Wire.h> | ||
#include <Servo.h> | ||
#include <EEPROM.h> | ||
|
||
|
||
#define DEBUGGING | ||
|
||
#include "Blinker.h" | ||
|
@@ -23,7 +51,7 @@ | |
#define THROTTLE_MIN 0.05 // the lowest throttle to send the ESC | ||
#define THROTTLE_CC_BUMP 0.002 // CC = 0.1% throttle increase; 50/s = 10s to hit 100% on cruise | ||
#define THROTTLE_SMOOTHNESS 0.05 // default "smoothing" factor | ||
#define THROTTLE_MIN_CC 0.10 // minimum / inital speed for cruise crontrol | ||
#define THROTTLE_MIN_CC 0.05 // minimum / inital speed for cruise crontrol | ||
// note that a different value may be stored in EEPROM | ||
#include "Throttle.h" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
/* | ||
* (CC BY-NC-SA 4.0) | ||
* http://creativecommons.org/licenses/by-nc-sa/4.0/ | ||
* | ||
* WARNING WARNING WARNING: attaching motors to a skateboard is | ||
* a terribly dangerous thing to do. This software is totally | ||
* for amusement and/or educational purposes. Don't obtain or | ||
* make a wiiceiver (see below for instructions and parts), | ||
* don't attach it to a skateboard, and CERTAINLY don't use it | ||
* to zip around with just a tiny, ergonomic nunchuck instead | ||
* of a bulky R/C controller. | ||
* | ||
* This software is made freely available. If you wish to | ||
* sell it, don't. If you wish to modify it, DO! (and please | ||
* let me know). Much of the code is derived from others out | ||
* there, I've made attributuions where appropriate. | ||
* | ||
* http://austindavid.com/wiiceiver | ||
* | ||
* latest software: https://github.com/jaustindavid/wiiceiver | ||
* schematic & parts: http://www.digikey.com/schemeit#t9g | ||
* | ||
* Enjoy! Be safe! | ||
* | ||
* (CC BY-NC-SA 4.0) Austin David, [email protected] | ||
* 12 May 2014 | ||
* | ||
*/ | ||
|
||
/* | ||
* version detection -- pin layouts change over time ... | ||
* historical note: CSEL = "chip select" | ||
|
@@ -49,7 +78,7 @@ void chipSelect (void) { | |
/* | ||
* locations are specified in the following table: | ||
* rows == component | ||
* columns = version; first column = v1, second = v2, etc | ||
* columns = version; first column = v0, second = v1, etc | ||
*/ | ||
int pinLocation(int pinID) { | ||
int pinMap[6][2] = { | ||
|
@@ -59,7 +88,7 @@ int pinLocation(int pinID) { | |
{10, 9}, // ESC_PPM PWM required | ||
{9, 11}, // WII_POWER any digital pin | ||
{19, 19}, // WII_SCL A5, don't change | ||
{18, 18}, // WII_SDA A4, don't cange | ||
{18, 18}, // WII_SDA A4, don't change | ||
}; | ||
|
||
if (CSEL < 0) { | ||
|