Skip to content

Commit

Permalink
RC2
Browse files Browse the repository at this point in the history
added CC BY-NC-SA 4.0 attribution, comments / disclaimers, and some
minor code cleanup.
  • Loading branch information
jaustindavid committed May 13, 2014
1 parent 9f045f9 commit cf42c42
Show file tree
Hide file tree
Showing 7 changed files with 212 additions and 25 deletions.
29 changes: 29 additions & 0 deletions Wiiceiver/Blinker.h
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

Expand Down
33 changes: 31 additions & 2 deletions Wiiceiver/Chuck.h
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

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
29 changes: 29 additions & 0 deletions Wiiceiver/ElectronicSpeedController.h
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

Expand Down
29 changes: 29 additions & 0 deletions Wiiceiver/Smoother.h
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

Expand Down
52 changes: 33 additions & 19 deletions Wiiceiver/Throttle.h
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

Expand Down Expand Up @@ -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) {
Expand Down
32 changes: 30 additions & 2 deletions Wiiceiver/Wiiceiver.ino
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"
Expand All @@ -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"

Expand Down
33 changes: 31 additions & 2 deletions Wiiceiver/pinouts.h
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"
Expand Down Expand Up @@ -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] = {
Expand All @@ -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) {
Expand Down

0 comments on commit cf42c42

Please sign in to comment.