<commit_before>static int LED_COUNT = 32;

void setup()
{
  Serial.begin(115200);
  
  DDRB = 0xFF;
  DDRD = 0xFF;
}

//// For teensy prototypes
//void send_single_byte(uint8_t c)
//{
//  // D5 is clock, D4 is data
//  for(uint8_t i = 0; i < 8; i++) {
//    PORTD = (((c >> (7 - i)) & 0x01) << 4);
//    PORTD = (((c >> (7 - i)) & 0x01) << 4) | 0x20;
//  }
//}

// For blinkyboards
void send_single_byte(uint8_t c)
{
  // D5 is clock, D4 is data
  for(uint8_t i = 0; i < 8; i++) {
    PORTB = (((c >> (7 - i)) & 0x01) << 2);
    PORTB = (((c >> (7 - i)) & 0x01) << 2) | 0x02;
  }
}

void send_pixel(uint8_t red, uint8_t green, uint8_t blue) {
  send_single_byte(0x80 | red);
  send_single_byte(0x80 | green);
  send_single_byte(0x80 | blue);
}

int j = 0;
int f = 0;
int k = 0;


uint8_t i = 0;
void loop()
{
  // If'n we get some data, switch to passthrough mode
  if(Serial.available()) {
    while(true) {
      send_single_byte(Serial.read());
      while(!Serial.available()) {}
    }
  }
    
  
  float brightness = random(100,100)/100.0;
  
  for (uint8_t i = 0; i < LED_COUNT; i++) {
    uint8_t red =   64*(1+sin(i/2.0 + j/4.0       ))*brightness;
    uint8_t green = 64*(1+sin(i/1.0 + f/9.0  + 2.1))*brightness;
    uint8_t blue =  64*(1+sin(i/3.0 + k/14.0 + 4.2))*brightness;
    
    send_pixel(red, green, blue);
  }

  j = j + random(1,2);
  f = f + random(1,2);
  k = k + random(1,2);

//  j = k;
//  for (uint8_t i = 0; i < LED_COUNT; i++) {
//    if (j == 0) {
//      send_pixel(127,64,0);
//    }
//    else if(j == 1) {
//      send_pixel(64,127,0);
//    }
//    else if(j == 2) {
//      send_pixel(0,127,64);
//    }
//    else if(j == 3) {
//      send_pixel(0,64,127);
//    }
//    else if(j == 4) {
//      send_pixel(64,0,127);
//    }
//    else {
//      send_pixel(127,0,64);
//    }
//    
//    j = (j+1)%6;
//  }
//  k = (k+1)%6;
  
  send_single_byte(0x00);
 

}



<commit_msg>Clean up the arduino example a bit. Serial override mode exists now.<commit_after>static int LED_COUNT = 32;

void setup()
{
  Serial.begin(57600);
  
  bitClear(PORTB, PORTB1);
  bitClear(PORTB, PORTB2);
  
  bitSet(DDRB, DDB1);
  bitSet(DDRB, DDB2);
}

// For blinkyboards
void send_single_byte(uint8_t c)
{
  for(uint8_t i = 0; i < 8; i++) {
    // PB1 is clock, PB2 is data
    if(c >> (7 - i) & 0x01) {
      bitSet(PORTB, PORTB2);
    }
    else {
      bitClear(PORTB, PORTB2);      
    }
    
    bitSet(PORTB, PORTB1);
    bitClear(PORTB, PORTB1);
  }
}

void send_pixel(uint8_t red, uint8_t green, uint8_t blue) {
  send_single_byte(0x80 | red);
  send_single_byte(0x80 | green);
  send_single_byte(0x80 | blue);
}

uint8_t i = 0;
int j = 0;
int f = 0;
int k = 0;

void loop()
{
  // If'n we get some data, switch to passthrough mode
  if(Serial.available() > 0) {
    while(true) {
      if(Serial.available() > 0) {
        char c = Serial.read();
        send_single_byte(c);
      }
    }
  }
  
  float brightness = random(100,100)/100.0;
  
  for (uint8_t i = 0; i < LED_COUNT; i++) {
    uint8_t red =   64*(1+sin(i/2.0 + j/4.0       ))*brightness;
    uint8_t green = 64*(1+sin(i/1.0 + f/9.0  + 2.1))*brightness;
    uint8_t blue =  64*(1+sin(i/3.0 + k/14.0 + 4.2))*brightness;
    
    send_pixel(red, green, blue);
  }

  j = j + random(1,2);
  f = f + random(1,2);
  k = k + random(1,2);
  
  send_single_byte(0x00);
}




{'fraction_non_alphanumeric': 0.19356759976176297, 'fraction_numerical': 0.07623585467540203, 'mean_word_length': 2.226705091258405, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5802056', 'n_tokens_mistral': 1643, 'n_tokens_neox': 1507, 'n_words': 324}