help with leds blinking to music

Ok so im in the process of building a portable car stereo and i have everything done except for putting some leds blinking to the music on it. i have attempted this in the past and it never really worked how i wanted it to. so i cant really explain every connection in my box but i will explain the components used car stereo      12-14v Xbox power supply    12v drill battery    12-13v drill charger   2 relays used to automatically switch from the wall battery   and the battery charger  everything shares a ground and connected to the stereo have leds hooked up to the remote normally used to switch on car amps   its output is 12v and i think 300 milliamps i would like to use this for the power and i need to use the speaker output as the audio  i tried to use a tip31 but it never worked the way i needed it to just ask if u need any more info

Topic by kylejjjjj 


Synchronous AC110V Motor Question

I have a small AC synchronous microwave motor that I want to use for a project. The problem is that even though it says CCW/CW, which i take it to mean counter clockwise and clockwise, it randomly seems to choose which direction it wants to turn rather than me reversing the current to change the direction. What makes this motor randomly choose a direction? Is it some internal component that randomly decides it's direction? Basically, is there a way I can make it go the direction I want? If not, can someone point out a small size motor type that is cheap and has a lot of torque? Thanks to anyone who replies!

Topic by rodneykristy   |  last reply


RadioShack Tri Color LED strip light show help?

I'm having partial success creating a synchronized light show by calling some colors and adding delays. My main problem is creating specific colors or even displaying one color on the entire strip.  here's the default code for the strip for arduino: #include // ******** DEBUG ==== should auto config to adapt different mother board ********* //#define DATA_1 (PORTF |=  0X01)    // DATA 1    // for ATMEGA //#define DATA_0 (PORTF &=  0XFE)    // DATA 0    // for ATMEGA //#define STRIP_PINOUT DDRF=0xFF  // for ATMEGA #define DATA_1 (PORTC |=  0X01)    // DATA 1    // for UNO #define DATA_0 (PORTC &=  0XFE)    // DATA 0    // for UNO #define STRIP_PINOUT (DDRC=0xFF)    // for UNO PROGMEM const unsigned long pattern_test_red[10][10]={   {0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000}, }; PROGMEM const unsigned long pattern_test_blue[10][10]={   {0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00}, }; PROGMEM const unsigned long pattern_test_green[10][10]={   {0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff}, }; PROGMEM const unsigned long pattern_test_white[10][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet1[][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet2[][10]={   {0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff},   {0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet3[][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff},   {0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x444444},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0xffffff,0x444444,0x111111},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0xffffff,0x444444,0x111111,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0xffffff,0x444444,0x111111,0x000000,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0xffffff,0x444444,0x111111,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xffffff,0x444444,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xffffff,0x444444,0x111111,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0xffffff,0x444444,0x111111,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0xffffff,0x444444,0x111111,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_rainbow[10][10]={   {0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000},   {0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000},   {0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000},   {0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff},   {0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff},   {0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff},   {0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00},   {0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00},   {0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00},   {0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000}, }; // *********************************************************************************************************** // * // *                            Power Up Init. // * // * // *********************************************************************************************************** void setup() {                  STRIP_PINOUT;        // set output pin - DEBUG: should auto detect which mother board for use   reset_strip();   //noInterrupts(); } // *********************************************************************************************************** // * // *                            Main Loop // * // * // *********************************************************************************************************** void loop() {   send_1M_pattern(pattern_test_red, 10, 500);   delay(500);   send_1M_pattern(pattern_test_blue, 10, 500);   delay(500);   send_1M_pattern(pattern_test_green, 10, 500);   delay(500);   send_1M_pattern(pattern_test_white, 10, 500);   delay(500);   send_1M_pattern(pattern_test_comet1, 10, 70);   delay(500);   send_1M_pattern(pattern_test_comet2, 10, 70);   delay(500);   send_1M_pattern(pattern_test_comet3, 10, 70);   delay(500);         while (1)   {     send_1M_pattern(pattern_test_rainbow, 10, 70);   }   /* frame++;     if(frame<=10) LEDSTRIP_PATTERN_0();     if(10     if(20     if(frame>30) frame=1;    */   //delay(1); } /******************************************************************************* * Function Name  : send_1M_pattern * Description    : Transmit pattern to whole 1 meter strip *                  * Input          : pointer to ROM pattern; pattern length; frame rate *                  * Output         : None * Return         : None *******************************************************************************/ void send_1M_pattern(const unsigned long data[][10], int pattern_no, int frame_rate) {   int i=0;   int j=0;   uint32_t temp_data;   for (i=0;i   {     noInterrupts();     for (j=0;j<10;j++)     {       temp_data=pgm_read_dword_near(&data;[i][j]);       send_strip(temp_data);     }     interrupts();     delay(frame_rate);   } } /******************************************************************************* * Function Name  : send_strip * Description    : Transmit 24 pulse to LED strip *                  * Input          : 24-bit data for the strip *                  * Output         : None * Return         : None *******************************************************************************/ void send_strip(uint32_t data) {   int i;   unsigned long j=0x800000;     for (i=0;i<24;i++)   {     if (data & j)     {       DATA_1;       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");          __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       /*----------------------------*/       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");        __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");        __asm__("nop\n\t");        __asm__("nop\n\t");        /*----------------------------*/            DATA_0;     }     else     {       DATA_1;       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");          DATA_0; /*----------------------------*/             __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");      /*----------------------------*/             }     j>>=1;   }   } /******************************************************************************* * Function Name  : reset_strip * Description    : Send reset pulse to reset all color of the strip *                  * Input          : None *                  * Output         : None * Return         : None *******************************************************************************/ void reset_strip() {   DATA_0;   delayMicroseconds(20); } //***********AND HERE"S MY MODIFIED LIGHT SHOW CODE:*********** #include // ******** DEBUG ==== should auto config to adapt different mother board ********* //#define DATA_1 (PORTF |=  0X01)    // DATA 1    // for ATMEGA //#define DATA_0 (PORTF &=  0XFE)    // DATA 0    // for ATMEGA //#define STRIP_PINOUT DDRF=0xFF  // for ATMEGA #define DATA_1 (PORTC |=  0X01)    // DATA 1    // for UNO #define DATA_0 (PORTC &=  0XFE)    // DATA 0    // for UNO #define STRIP_PINOUT (DDRC=0xFF)    // for UNO PROGMEM const unsigned long pattern_test_red[10][10]={   {0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xff0000}, }; PROGMEM const unsigned long pattern_test_blue[10][10]={   {0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x00ff00}, }; PROGMEM const unsigned long pattern_test_green[10][10]={   {0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000ff}, }; PROGMEM const unsigned long pattern_test_white[10][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet1[][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet2[][10]={   {0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff},   {0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000},   {0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_comet3[][10]={   {0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff},   {0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0xffffff,0x444444},   {0x111111,0x444444,0xffffff,0x000000,0x000000,0x000000,0x000000,0xffffff,0x444444,0x111111},   {0x000000,0x111111,0x444444,0xffffff,0x000000,0x000000,0xffffff,0x444444,0x111111,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0xffffff,0x444444,0x111111,0x000000,0x000000},   {0x000000,0x000000,0x111111,0x444444,0xffffff,0xffffff,0x444444,0x111111,0x000000,0x000000},   {0x000000,0x000000,0x000000,0xffffff,0x444444,0x444444,0xffffff,0x000000,0x000000,0x000000},   {0x000000,0x000000,0xffffff,0x444444,0x111111,0x111111,0x444444,0xffffff,0x000000,0x000000},   {0x000000,0xffffff,0x444444,0x111111,0x000000,0x000000,0x111111,0x444444,0xffffff,0x000000},   {0xffffff,0x444444,0x111111,0x000000,0x000000,0x000000,0x000000,0x111111,0x444444,0xffffff}, }; PROGMEM const unsigned long pattern_test_rainbow[10][10]={   {0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000},   {0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000},   {0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000},   {0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff},   {0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff},   {0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00,0x0000ff},   {0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00,0x00ff00},   {0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00,0xffff00},   {0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000,0xff7f00},   {0xff7f00,0xffff00,0x00ff00,0x0000ff,0x6f00ff,0x8f00ff,0x000000,0x000000,0x000000,0xff0000}, }; // *********************************************************************************************************** // * // *                            Power Up Init. // * // * // *********************************************************************************************************** void setup() {                  STRIP_PINOUT;        // set output pin - DEBUG: should auto detect which mother board for use   reset_strip();   //noInterrupts(); } // *********************************************************************************************************** // * // *                            Main Loop // * // * // *********************************************************************************************************** void loop() {   send_1M_pattern(pattern_test_white, 0, 0);   delay(36000);   send_1M_pattern(pattern_test_white, 500,0);   delay(5000);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);    send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);    send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);     send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 10, 70);   delay(10);   send_1M_pattern(pattern_test_white, 500, 0);   delay(4000);       while (1)   {     send_1M_pattern(pattern_test_rainbow, 10, 70);   }       /* frame++;     if(frame<=10) LEDSTRIP_PATTERN_0();     if(10     if(20     if(frame>30) frame=1;    */   //delay(1); } /******************************************************************************* * Function Name  : send_1M_pattern * Description    : Transmit pattern to whole 1 meter strip *                  * Input          : pointer to ROM pattern; pattern length; frame rate *                  * Output         : None * Return         : None *******************************************************************************/ void send_1M_pattern(const unsigned long data[][10], int pattern_no, int frame_rate) {   int i=0;   int j=0;   uint32_t temp_data;   for (i=0;i   {     noInterrupts();     for (j=0;j<10;j++)     {       temp_data=pgm_read_dword_near(&data;[i][j]);       send_strip(temp_data);     }     interrupts();     delay(frame_rate);   } } /******************************************************************************* * Function Name  : send_strip * Description    : Transmit 24 pulse to LED strip *                  * Input          : 24-bit data for the strip *                  * Output         : None * Return         : None *******************************************************************************/ void send_strip(uint32_t data) {   int i;   unsigned long j=0x800000;     for (i=0;i<24;i++)   {     if (data & j)     {       DATA_1;       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");          __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       /*----------------------------*/       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");        __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");        __asm__("nop\n\t");        __asm__("nop\n\t");        /*----------------------------*/            DATA_0;     }     else     {       DATA_1;       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");          DATA_0; /*----------------------------*/             __asm__("nop\n\t");       __asm__("nop\n\t");       __asm__("nop\n\t");      /*----------------------------*/             }     j>>=1;   }   } /******************************************************************************* * Function Name  : reset_strip * Description    : Send reset pulse to reset all color of the strip *                  * Input          : None *                  * Output         : None * Return         : None *******************************************************************************/ void reset_strip() {   DATA_0;   delayMicroseconds(20); }

Question by ray33_ 


Help with LED's on headphones synchronized to music.

I want to be able to put LED lights in my SkullCandy headphones and have them synchronize to the music or at least light up and look cool. Maybe I could throw in a 555IC and have the LED's blink from left to right. I have read online how to do it and I'm stuck. If someone could please explain how to do it or show me in a video. I have a multimeter and such. I don't know the model number or model name of the headphones. I will post pictures of the headphones and where I want the LED's. I don't think this matters much but I want to use high-intensity bright green LED's. I know how to take them apart. I would prefer if I didn't have to use a transistor, but if I have to then I will. Please send me a schematic or something. Thanks. On the picture where I am pointing that is where I want the LED's.

Topic by Wally_Z   |  last reply


Mp3 players (except ipods) and itunes synchronizing software?

I was wondering if i can synchronize my mp3 player with itunes and not use the drag and drop utility

Question by arv_christos   |  last reply


what is hybrid electricity grid?

How to synchronize solar and wind energy?

Question by    |  last reply


AC 30v 50/60Hz Synchronous Motor from 110

So I bought some Mirrowave turn table motors to use as an Epoxy Rod dryer I knew I didnt want the 220's and thought I had bought 110 AC  but they are  AC 30V    3W   I have 4 of them and need to know a cheap way to wire em up.  Was being cheap and didnt want to pay $10 a motor and got all 4 for $10 but now I see I am going to need a voltage reduction and or transformer.  Was thinking one of my old printer or laptop cubes would work.. but those are all AC/DC converters :-( I am pretty good with hands.. but Electrical circuits not my strong suit. 

Question by ToddG39   |  last reply


Which power do i need to run a motor as a generator in the following environment?

I want to generate electricity with a rotating axis at a power of 3 Watt. The mechanical torque (depending on the gearbox) on the input axis varies between 0.73 Nm (@ 250 rpm) and 0.122 Nm (@ 1500 rpm). Currently i am thinking about a synchronous machine, because it yields higher efficiency, but it is very difficult for me to find a synchronous machine fulfilling the mechanical torque regarding the power.  Furthermore i usually just find motors in that size, so i need to turn them around but i have problems understanding the data sheet. For example this motor: Name: ASM 16 Output Power: 3.1 W Input Power: 9.2 VA Rotation velocity: 1000 rpm As this is a motor, but i want to use it as a generator, should i align the output power from the motor with my input power (the 3 W mentioned above, and than as a generator)?  Can you please give me some ideas how o progress from here? 

Question by falko_doering   |  last reply


Why use 2 mosfets? Answered

Http://electronicdesign.com/site-files/electronicdesign.com/files/archive/electronicdesign.com/content/14978/60488_fig_01.gif In the circuit, they use 2 mosfets namely q1 and q2. I was thinking what does q1 do. I tried simulating the circuit with and without q1 and the result were identical. Almost all synchronous rectifiers are following this pattern, what could be the purpose of q1? input and output conditions... Input: sine wave similar to AC mains (100Vrms 60Hz) Output: half wave rectified sinewave Load: 1kOhm resistor The red curve in the graph represents the voltage in the output The blue curve in the graph represents the voltage of a 1 ohm resistor in the input (for current reading purposes)

Question by codestroy7   |  last reply


How to synchronize the brightness of a grille-mounted neon tube/LED bar to a car's tach/speedo?

I have a 1997 BMW 328i, and I've been thinking about installing either a neon tube or a bar of LED's in the grille of the car to use at night (most likely not street legal, I know). I want the brightness of the tube/bar to be controlled by one of two things: The speedometer or the tachometer. I.e., if the speedometer is at 0 MPH, the light is off, and if the speedo is at 75 MPH, the light is fully on. Same thing with the tach, light off at 0 RPM, light fully on at redline. Unfortunately, I haven't the slightest idea how to use the car's computer or the gauges themselves to set up a control module for the light. If any of you has a good amount of knowledge about automotive gauges, I would appreciate your help!

Question by Jonny Katana   |  last reply


what is meant by ESCs calibration?

I know how to calibrate ESCs on the quad-copter. Howver, I dnt understand the concept of calibration. What is meant by ESC callibrarion? what happens when we calibrate the ESCs? is it so they move synchronously or so the PWM signal reaches each ESC at the same time?

Question by Bam Boy   |  last reply


DISNEY LED SHOW HELP?

I have a paper model of "Sleeping Beauty Castle" of Disneyland. I got this model from disneyexperience.com and I need to make the lighting on the castle exactly or like the one at Disney during their firework shows.Now I'd like to place the LEDs around the perimeter of the inside of the castle. The perimeter meaning the space in between the castle and the pink top part of the castle. I want to know if you guys know how to program them to change color fade and do other effects and to synchronize the lights to music. And not just flashing or pulsing to music, but being part of it...just like the one at Disneyland. I'd also like to have a dimming effect on it too. And the LEDS will be 7 color changing ones. ANY help would be gladly appreciated. THANK YOU. Please let me know if you need anything on my end.

Question by ray33   |  last reply


synchonized flash light for cheap?

Also posted in "burning question " forum Hi, I am looking for someone who could do an synchonized flash light such as this one but for much cheaper ;-) The challenge is on synchronizing the camera with the flashlight, if possible wireless. The light itself and the diffuseur are no real topic. The use of such devices helps a lot when taking pics for your I'bles or your ETSY shop if you have one. Thx B

Topic by BaptisteL8 


Led problem

Hello, I apologize for my bad English, I'm from a country where English is not the official. I have a problem, I made ​​a circuit to synchronize the lights to music with a TIP31. the problem is when I connect it to the amplifier is blown, I fixed it, but I do not understand why it burns, can you help me? Is it because TIP31 is powered by 12V? If you could help me find a solution?

Topic by mitza sb   |  last reply


Help with TIP 31 Sound Reactive LED's Answered

I am having trouble getting my led strip to blink to music.  I built this circuit: I have tried this with a battery powered strip of led's and it worked perfectly, but when I connect it to the led's powered by the power supply, it either doesn't turn on at all or is extremely dim. Could someone explain why it isn't working?

Question by cardboarddude   |  last reply


Help with making a triangle wave sequencer with pitch relative to tempo, please? Answered

I'd like to make a low frequency triangle wave oscillator/sequencer, but the oscillator and sequencer have to somehow be synchronized with each other, so that if the tempo gets doubled, for example, the pitch also goes up one octave. How can I do this? I've already made a circuit based on this oscillator and the 4017 decade counter as a sequencer. (Ignore all capacitor, resistor and pot values; I haven't defined them yet)

Question by aelias36   |  last reply


Dropbox application in background process on OpenWRT processor of my Arduino Yun.

Hello everybody, Simple question: does the Arduino YUN support the same DROPBOX functionalities as my laptop? Basically, I need to download data from the SD card of my Arduino Yun to my application server. But the internet connection of my Arduino is not very stable. How I want it to work: 1.    I have a sketch that writes data on a TXT file to my SD card every 10 minutes 2.    I want to install Dropbox on my Arduino Yun 3.    Then, whenever the Yun is connected, it will synchronize all the files from the SD Card with my Dropbox folder on my server. That would happen (I guess) in the background, without my Arduino needing to run a sketch. To do that, I think I need drobox to run ‘in the background’ on my Arduino microprocessor. Did anyone do this before? Thanks. What does NOT work: Initially, I used the "LogToDropbox" sketch inserted in the "Datalogging to Dropbox with Arduino Yun" tutorial at the following link: https://www.instructables.com/id/Datalogging-to-Dropbox-with-Arduino-Yun/ in order to ‘actively’ upload files to my Dropbox app console from my SD card with an internet connection. But if , my Arduino Yun is losing the internet connection, it is impossible to upload the files created during the downtime to my Dropbox app console. These files are stored on the SD card plugged on the Yun during this time interval, but not synchronized.

Topic by DELETED_jay97430 


What Capacitor size for a 4 stack MOT Tesla coil?

I have just bought a 4 stack MOT transformer in a case and oil filled it says 8.6kv on it but no idea of amperage, I have a large variable ballast and hooked it up to my test jacobs ladder and it pulls about 10amp and really fires the ladder well. My coil has a 6inch by 29inch winding on the secondary and a Synchronous spark gap (200bps) but I cant seem to get a decent spark off it I have an MMC of 44.0nF @20kv at the moment 

Question by GordieO1   |  last reply


Stator back iron and Slot dept determination? Answered

Hi All! I am working on Permanent Magnet Synchronous Motor design. I need assistance on how to determine analytically or by any means possible stator back iron and slot dept dimensions other than using machine design software or application. Also, the Rotor Core size or diameter so as to know the spindle diameter. In the course of my research, I had uncovered how to calculate slot width, tooth width, pole arc etc but am yet to solve above problem. Anyone with the solution please help! Thanks in anticipation.

Question by Ugoem   |  last reply


What will be the effect of series connection of two fans on static pressure of air? Answered

I have bought two similar  axial fan blades similar in each respect pitch,size,material,angle of attack etc below is the image.I have a powerful 300W electric motor.I want to attach{weld} both of these blades with the shaft of the same motor in series one above the another on the same motor shaft this would ensure that both the blades rotate with same RPM ,of course they would be separated by some distance i know that series connection of fans would increase the static pressure of air,but what confuses me a lot is that how the guide vanes{wings} of both the blades be aligned with respect to each other for maximum static pressure should the wings of both the blades synchronize with each other i-e clocked at the same rate or should they be at different positions with respect to each other.I have searched every forum but nothing fould.You people are my last hope.

Question by LoRD CurZoN   |  last reply


Laser Pointer shooting range ideas?

Idea is to slightly modify the annoy a tron circuit to turn on a laser pointer at a specific time interval, then back off... Then i would put this into my lego mindstorms robotic thingy that will point the laser to random points on the walllink to annoy a tron: https://www.instructables.com/id/Homemade_Annoy_a_thing_Annoy_a_tron/thats all great and a work in progress, really just background inforeal question, just askin, is what technologies are there that would allow a microcontroller to "sense" where the laser is pointing and then to link that info to an sensor that would find where the bb bullet hits? Then just give me a percentage of how far off i was from the dot, maybe in the form of an LED bargraph display like this one: http://www.goldmine-elec-products.com/prodinfo.asp?number=G8942this isnt something i expect to do, but i want to do something with 555s and this looks like a pretty cool ideato clarify, on the top part, the laser and lego mindstorms are 2 separate systems, one is simply mounted on the other, but by using the same timings it is possible to make them work synchronously... its a work in progress, stay tuned if interested

Question by raykholo 


Converting 3 AAA device to direct power point plug Q?

Dear electronic gurus, i need some urgent assistance with this "relatively" simple problem, but am not sure how to work it out... i have a device that is like a multi-colour changing light bulb ( not sure if it is glass or led ( most probably the later)), which REQUIRES 3 AAA batteries in the sequence of UP DOWN UP (standing arrangement) and I wish to convert this towards something that i could directly use a DC plug point power source ( 240v ) ... Can anyone please assisst / provide an instructable for me ? I've looked at something like this (http://www.ebay.com.au/itm/AU-Power-Supply-Adapter-Converter-AC-110-240V-to-DC-4-5V-1A-w-6-x-plug-converter-/200874819533?pt=AU_Laptop_Accessories&hash;=item2ec5127fcd) which is a AU Power Supply Adapter Converter 100V-240V AC to DC 4.5V 1A Jack 5.5x2.1MM but am not sure if it is correct and don't want the light bulb to blow up on me .. i understand some soldering may be required but need guidance on the whole project.... Please please throw your ideas at me I'm thinking if this is successful, i might do it for another similar device making it two light bulbs  which can be powered through the same point if possible to maintain synchronization of the colour change :) Thanks heaps in advance!! :D

Question by porkupine888 


Neotech NT7086 display and arduino?

I found a couple of these older looking dot matrix LCDs in some electronic logbooks that didnt work. it was a 14 pin connector, so i figured why not try it out. i found the pinout of each pin using the chips that were on board, but i don`t know where to go from here, or if i should even bother. the display was made by or for hantronix, and they have a touch layer that could be used as well. each display has 7 of the NT7086PQ chips on it, a 74HC74D, a 74HC40103D, and an LM324. it was originally connected via a flat flex cable, but it had a convenient place for headers to plug it into a breadboard. the 74HC40103D is an 8-bit synchronous binary down counter: http://www.nxp.com/documents/data_sheet/74HC40103.pdf the 74HC74D is a Dual D-type flip-flop: http://www.mouser.com/ds/2/302/74HC_HCT74-225071.pdf the Neotech chips are LCD display drivers: http://www.crystalfontz.com/controllers/NT7086.pdf upon inspecting the physical properties of the display I can see there are the rubber/carbon edge contacts on two sides and a ribbon on one end. The pinout i figured out is: 14 is GND 13 is base on SOT23 transistor     (connected to 12 on parent board) 12 collector on a SOT23 transistor 11 gets pulled low at some point (pulled low on parent board) 10 is power 9 is cl2          (unactive high?) (on one set of neotech chips, assuming the edge contact drivers) 8 Clock input (74HC40103D) 7 does nothing 6 is d4 on one chip? 5 is display off  (active low) 4 is d4 3 is d3 2 is d2 1 is d1 So i would appreciate any input people have. I would ideally like to drive this using an arduino/atmega, and although i have not read the neotech datasheet to much depth it would appear to work similar to the popular parallel displays, but maybe with different syntaxes. so is this a possible thing, or is it a fruitless endeavor? thanks in advance.

Question by zack247   |  last reply


How can I create a PPM-generating device whose output can be recorded as audio?

Dear Community,          In the late 80s and early 90s, the whole Teddy Ruxpin craze took off, and there were many spin-offs on this.  The basic idea was that the toy had a cassette player where one channel was directed to an audio circuit in the usual way, and the other channel had animation synchronization code directed to some sort of receiving circuit which controlled motors to make the mouth and eyes move so it would appear to be telling a story or singing a song.  My favorite instance of this (which I had as a child), is the Ideal Big Bird Storymagic based on the famous Sesame Street character.  There were so-called "satellite toys", Cookie Monster and Oscar which connected to Big Bird via a special patch cord, and they talked along and helped Big Bird tell the story.  I never had those though.  Different fans tell me that the animation sync code is Pulse-position modulation, the same code used over radio waves to guide remote controlled cars and helicopters.  I'm not sure if this is true or not.  I've looked at it in a waveform editor, and there appears to be some amplitude modulation going on here too.  (Please see below).  The highlighted (white) section is the span of two words.  The right (lower) channel shows the voice speaking these two words, and the left (upper) channel shows what happens to the code (which really sounds like a fax machine) as he moves his jaw down, up, and down again in time with the words.  Is this PPM, and if not, what is it? Now that I'm in my mid 20s, and I work with young children, I found one of these Ideal Big Birds on Ebay in great working order.   I'm wondering if it's possible to try to re-create what the manufacturers used to create this sync code in the first place.  Sesame Street created many nice "regular" story / music tapes with Big Bird as the central character.  I thought it might be cool to take some of these (especially the Follow That Bird soundtrack) and add the sync to make my own sort of unofficial storymagic tape (just for fun, and for my students, not to sel or share, as this would be a copyright issue).      I'm wondering if some sort of 1KHz oscillator-like device could be built that has levers of some kind, which could be routed through a DAW or a mixer, which would allow one to perform along with a program, and place the appropriate modulation envelopes into the stream of PPM to place the movements?  I think there are at least two kinds of modulation in the code; that for the beak, and for the eyes.  There must be other kinds of modulation for Cookie Monster and for Oscar.  If something like this seems practical and feasible, I'd enjoy learning about it, just for the fun of it.  If it is possible, I am also wondering how or where I could have it built, and for what sort of budget, as I am far better with my ears than with the soldering iron.  I have tried and tried, to no avail, to find someone in the “talking toys” community who knows how this was originally created.  Let me know if you'd like me to send you a clip of the audio file.  Here's a link to someone else's on Youtube so that you can see what I'm talking about.  Thank you so much for taking the time to read all of this senseless ramble!! http://www.youtube.com/watch?v=xxCnmao8FAs Thanks a ton for any insights that you have!!!  I apologize in advance for the inherent nutty-ness of this post! ;)  Sincerely, Jessica

Question by jtsoundtech   |  last reply


Useful Batch Commands

Hey guys, I wanted to post a quick forum topic about useful batch commands that are seldom used or not well-known, or maybe just useful tidbits. Note: These do not have to be used, they are just extremely helpful and are just "extra," meaning you could probably find easier-to-understand but not as useful commands. 1. The CHOICE command The reason this command is so cool is that unlike other Y/N menus, when you enter the desired number, you don't have to hit enter, it goes straight to the next screen. You can also program it to execute a command after a set amount of time. Here's how to write it out: choice /c:12345 /t:5,10 if errorlevel 5 goto ha if errorlevel 4 goto joke if errorlevel 3 goto tired if errorlevel 2 goto fried if errorlevel 1 goto chiken To time it, you type /t and then a colon. You write the choice that you want to be timed, e.g. 5, and the amount of time in seconds you want it to wait for seperated by a comma. 2. The Random Variable The reason I deceided to put this up is because it is one of the only if not the only variable that is already programmed into the system. By using it correctly, you can generate a number between 1 and 32767. WHAT?! Of course, you can narrow it down, to, say about 1 and 100. :dim set rnd=%random% if %rnd% GEQ 101 goto dim if %rnd% LEQ 0 goto dim set number=%rnd% So as you can see, %random% is a set variable and generates a random number for you. Please keep in mind that this can take one second, or one eternity (literally) since it doesn't narrow down the choices after finding that a number doesn;t work. So, you may keep on generating 101 forever and never get to 100! 3. The ^| Command. Ever get frustrated because you are making an animation with, for example, stick figures and are getting driven nuts because the minute it gets to a certain part, it exits on you? The reason is probably because you used the | symbol, which is actually knd of like a command by itself. So, if you're doing something like this: echo [0] echo /| echo / The reason it is not working is because you didin't use a ^ before the |. Here's what it should be: echo [0] echo /^| echo / Yes, it looks wierd in the editing stages, but looks much better in the real thing. Just remember, you will have to remember that the ^ will be invisible, so make sure everything else in front of it is like this: echo [0]   [ echo /^|    [ echo /     [ So that the [ or whatever it is is one space ahead from the others. 4. The %TIME:~0,5% Command. What time is it? Oh, it's 3:16:52.29! Ever been frustrated with the TIME command? For one, who ( and when I mean who, I mean the average batcher who doesn't use the TIME command to synchronize seven different computers around the house which I could never hope to do) needs to be that exact? When making a batch alarm clock, for example, the user wouldn't really want to do all of that, would they? So, for those of you who would want to make such a clock, here's an example: @echo off title Alarm Clock :start cls color f0 echo. echo Use 24 hour clock echo. set /p a=Set Alarm: cls echo. echo Alarm set to %a%. :alarm if %time:~0,5% EQU %a% goto alarmset goto alarm :alarmset color fc echo echo echo cls echo. echo It's %time:~0,5%! echo. echo Press 1 to acknowledge. choice /n /c:12 /t:2,1 if errorlevel 2 goto alarmset if errorlevel 1 goto sleep goto alarmset :sleep goto start So there's one example. %TIME:~0,5% sets the time from 3:15:00.00 to just 15:15. This doesn't work just with the TIME command, you can do this with any variable. If I had a variable %x% and it said "crayon" and wanted it to say "cray," I would type in %x:~0,-2%. If I wanted to make %x% say "on," I would type in %x:~-4,0%. 5. The AT Command The AT command is exactly what it appears to be. You tell it AT (time) /every:[day(s) of the week] (command to be executed). So, it I wanted an alarm to go off whenever the Simpsons are on, I'd type AT 19:30 /every:sumtwthfs echo ALARM!!! Now, I know that the Simpsons are on at a different time on Sundays, but that's not important. Please not that you HAVE to specify what day you want it to go off on (it can be dd/mm/yyyy to be really specific). Default is set to "tomorrow." This was probably too confusing. For one, I talk too much. Thank you for even getting this far, anyways. Thanks a bunch!

Topic by TheBatchies   |  last reply