Changeset - b7fb7b2649fd
[Not reviewed]
default
0 2 0
drewp@bigasterisk.com - 10 years ago 2015-06-13 06:39:03
drewp@bigasterisk.com
bug in setting rgb
Ignore-this: 380aa2d0c907faf69749636426d8de17
2 files changed with 2 insertions and 7 deletions:
0 comments (0 inline, 0 general)
light9/effecteval/effectloop.py
Show inline comments
 
@@ -205,25 +205,25 @@ class ControlBoard(object):
 
        level: 0 to 1
 
        """
 
        command = {0: '\x02', 1: '\x03'}[which]
 
        self._dev.write('\x60' + command + chr(max(0, min(1, level)) * 255))
 
        self._dev.flush()
 

	
 
    def setRgb(self, color):
 
        """
 
        color: (1, 3) array of 0..1 floats
 
        """
 
        if color.shape != (1, 3):
 
            raise ValueError("color was %s" % color.shape)
 
        self._dev.write('\x60\x04%s' + self._8bitMessage(color))
 
        self._dev.write('\x60\x04' + self._8bitMessage(color))
 
        self._dev.flush()
 

	
 
        
 
class LedLoop(EffectLoop):
 
    def initOutput(self):
 
        self.board = ControlBoard()
 
        self.lastSent = {} # what's in arduino's memory
 
        
 
    def combineOutputs(self, outputs):
 
        combined = {'L': Z, 'R': Z,
 
                    'blacklight0': 0, 'blacklight1': 0,
 
                    'W': numpy.zeros((1, 3), dtype=numpy.float16)}
rgbled/nanostrip.cc
Show inline comments
 
@@ -46,30 +46,25 @@ void setStrip(Adafruit_NeoPixel* strip) 
 
    byte b = Serial.read();
 
    strip->setPixelColor(i, strip->Color(g, r, b));
 
  }
 
  strip->show();
 

	
 
  digitalWrite(debugLed, 0);
 
}
 

	
 
int main(void) {
 
  init();
 
  pinMode(debugLed, OUTPUT);
 

	
 
  pinMode(3, OUTPUT);
 
  pinMode(6, OUTPUT);
 
  pinMode(9, OUTPUT);
 
  pinMode(10, OUTPUT);
 
  pinMode(11, OUTPUT);
 
  
 
    
 
  strip0.begin();
 
  strip1.begin();
 
  intro(); 
 
  Serial.begin(115200);
 
 
 
  uint8_t i;
 
  while (1) {
 
    while (Serial.available() <= 2) {
 
    }
 
    i = Serial.read();
 
    if (i != 0x60) {
 
      continue;
0 comments (0 inline, 0 general)