Pages: [1]   Go Down
Author Topic: serial.read from winamp Mini-SSC. [solved]  (Read 1918 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Macegr was kind enough to send me a plugin for winamp that would send data via the serial port  with the SSC format. this is the code i'm trying to build so i can get an led to pulse to music.

the first part is a small log of what winamp is sending out. When i use the serial monitor and input "ÿò........." or "ÿò" it takes the first one off which is 255 of and reads and prints the second value. in this case it's 242.  and the led turns on. but when winamp is sending out the data nothing happens..

i do know that i have the plugin configured to the right port because i've had mixed results in the past with the led blinking but not working correctly.. and when i would stop the plugin the light would turn off instantly.

any information you could share would be helpful.

thanks for your time,
Dave.
Code:
[10/02/2010 15:20:38]
93  IRP_MJ_WRITE - Request transfers data from a client to a COM port
   STATUS_SUCCESS
      255 225 000 000 000 000 000 000 000 000 000                           ÿá.........
----------------------------------------------------------------------------------
[10/02/2010 15:20:38]
95  IRP_MJ_WRITE - Request transfers data from a client to a COM port
   STATUS_SUCCESS
      255 235 000 000 000 000 000 000 000 000 000                           ÿë.........
----------------------------------------------------------------------------------
[10/02/2010 15:20:38]
97  IRP_MJ_WRITE - Request transfers data from a client to a COM port
   STATUS_SUCCESS
      255 242 000 000 000 000 000 000 000 000 000                           ÿò.........
----------------------------------------------------------------------------------
[10/02/2010 15:20:38]
99  IRP_MJ_WRITE - Request transfers data from a client to a COM port
   STATUS_SUCCESS
      255 242 000 000 000 000 000 000 000 000 000                           ÿò.........
----------------------------------------------------------------------------------


Code:
const int ledPin = 9;    
const int ledPin2 = 10;
const int ledPin3 = 11;
void setup()
{
  
  Serial.begin(9600);
  
  pinMode(ledPin, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
}



void loop() {
  int value = 0;
  if (Serial.available() >= 2) {
    
     byte i = Serial.read();
     if (int(i) == 255) {
      
       byte in = Serial.read();

       value = int(in);
      
     }
  }
    
     if (value > 0) {
       Serial.print(value);
      
       if (value > 0 && value < 150) {
         analogWrite(ledPin, 10);
         Serial.print(value);
       }
       if (value >= 150 && value < 220) {
         analogWrite(ledPin, 100);
         Serial.print(value);
       }
       if ( value >= 220 && value <=254) {
         analogWrite(ledPin, 255);
         Serial.print(value);
       }
      
     }
  
}

 // -------- end solution 1 ---------------
 //----------- solution 2 ----------------
  /*
  if (value > 0 && value < 230) {
    analogWrite(ledPin, 100);
    analogWrite(ledPin2, 0);
    analogWrite(ledPin3, 0);
  }
  if (value >= 230 && value < 240) {
    analogWrite(ledPin, 100);
    analogWrite(ledPin2, 100);
    analogWrite(ledPin3, 0);
  }
  if ( value > 240 && value <=254) {
    analogWrite(ledPin, 100);
    analogWrite(ledPin2, 100);
    analogWrite(ledPin3, 100);
  }
  */
  // ------------- end
« Last Edit: February 10, 2010, 06:44:09 pm by silvercg » Logged

SF Bay Area
Offline Offline
Edison Member
*
Karma: 10
Posts: 1235
Arduino Ninja
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you trying to actually see the data that Serial.print is supposed to echo? Because that might be your problem...if you load the Arduino program and then open the serial monitor, the Winamp plugin will not be able to connect to the same serial port. So you'll need to make sure that the Arduino serial monitor is never running when the plugin is running, and that the plugin is never running whenever you try to program the Arduino.

I also notice that your Serial.begin(9600) doesn't match with the 57600 that was set in the plugin as I sent it to you. If you haven't changed that in the plugin sourcecode, then you might try changing your Arduino code to Serial.begin(57600) instead.
Logged

Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

0
Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

o yes i should has said somthing about that..  i do close the serial monitor when i try to test with winamp and the other way around..  and the "prints" were just there for testing with the serial moniter.. i comment them out when i try to get it working with winamp..

as for the rate.. i'm not sure so i'll go check that out..

thanks macegr.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

 ;D ;D well don't i feel like a dumbass.

this whole time it was 57600  smiley-razz  

it's working now,  now i'm going to fine tune it and smooth it out.

macegr, you're my hero buddy.  ;D
« Last Edit: February 10, 2010, 06:58:59 pm by silvercg » Logged

SF Bay Area
Offline Offline
Edison Member
*
Karma: 10
Posts: 1235
Arduino Ninja
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Awesome, be sure to take a video and let us see how it works!
Logged

Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

Portugal
Offline Offline
God Member
*****
Karma: 5
Posts: 962
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Macegr, can you help me to compile your plugin, I have a legal copy of visual studio professional, and I have Qt too if needed, can you just send the compiled files?
Logged

Pages: [1]   Go Up
Jump to: