Show Posts
Pages: 1 [2] 3 4 ... 25
16  Forum 2005-2010 (read only) / Syntax & Programs / Re: HELP please on: July 02, 2008, 10:46:31 pm
I'd say

Code:
int potPin = 1;    
int Pin = 13;    
int val = 0;  
 
void setup() {
  pinMode(Pin, OUTPUT);
}
 
void loop() {
   val = analogRead(potPin);    
   if (val < 200) {
      digitalWrite(Pin, HIGH);
      delay(5000);
   }
   digitalWrite(Pin, LOW);
}
17  Forum 2005-2010 (read only) / Syntax & Programs / Re: Is there a way to `fork` a task? on: July 02, 2008, 06:41:55 pm
In fact, those nice ATmega168 are not multitask chips (neither is an Intel processor or whatever ^^)
The multitasking is done by software, so you need to think in chunks of time. You can't have 2 functions running at the same exact time, but you can delay them by a millisecond, for exemple.
In case of Leds, we use the Persistence of vision of the human eye, so that even if you light only one led at a time, if you do it fast enough, every leds will "seem" to be on to our slow eye.
I don't know what you want to do, but maybe the fact that a human brain can't process something as fast as you can make it happen will help you. Maybe if you want to move two motors on opposite direction and want it to happen "at the same time" can be done by moving bit by bit, and switching continuously between each motor. See what I mean ? ^^
18  Forum 2005-2010 (read only) / Syntax & Programs / Re: Strange Variable Problem on: June 25, 2008, 09:45:43 pm
Can it be because it's undefined ?
19  Forum 2005-2010 (read only) / Syntax & Programs / Re: fading out LED on non-pwm pins? on: June 08, 2008, 09:13:54 pm
another way is to use chips that can generate PWM, or a digital variable resistor. I think there's something on variable resistor in the playground.
20  Forum 2005-2010 (read only) / Syntax & Programs / Re: function-definition is not allowed..? on: June 13, 2008, 02:56:22 am
yeah, that's a comment, but with a bracket before the comment starter ( // ) and no statement, so the bracket was a pb, i think
21  Forum 2005-2010 (read only) / Syntax & Programs / Re: function-definition is not allowed..? on: June 12, 2008, 07:45:55 am
I'd say it's this line
  {//my protocol is going to be 20 bb cc (xx xx xx) cs

but not sure
22  Forum 2005-2010 (read only) / Syntax & Programs / Re: monome protocol on: June 08, 2008, 02:15:36 pm
New post on my blog, I got a little bit ahead on the code to differentiate each message type.
http://play-collective.net/blog/archives/48

cheers
23  Forum 2005-2010 (read only) / Syntax & Programs / Re: monome protocol on: June 05, 2008, 08:47:49 pm
Hi there.
I spent the evening working on how I'm gonna light my buttons, and I came with a design that might be do-able, but not easily I think. Any idea that might help ? More details here.
http://play-collective.net/blog/archives/44

Thanks ^^

NB : maybe an admin should move this post from Software / syntax& programs to General / Exhibition, or maybe a Projects section?
24  Forum 2005-2010 (read only) / Syntax & Programs / Re: monome protocol on: June 02, 2008, 10:09:34 pm
Hi there
Just to tell you that I made a blog, essentially for talking about this project.
I'll ask the questions here, and keep you posted about the project, but the blog is for publishing each step forward and think I have (this sentence doesn't seem to be correct, but I'm tired, it's 5 AM here ^^)
You can visit it here
http://play-collective.net/blog/
Don't hesitate to comment ^^

Cheers

melka
25  Forum 2005-2010 (read only) / Syntax & Programs / Re: monome protocol on: May 31, 2008, 06:17:21 pm
Hi julienb
I just sent you a mail, because I started a thread on the monome forum and thought you migh like to join
http://post.monome.org/comments.php?DiscussionID=1549&page=1#Item_15

Right now, I haven't made any significant progress on the arduino side, I was away in Shanghaï (yay!! great city, if you can, you must go there, especially Beijing Dong Lu, a lot of little shops selling everything you need, from ball bearings to electronic components)

I finished the max/msp patch (sends /rgb x y r g b) but now, I'm settling on the key matrix side : how can I have small sized (monome sized, I mean, not sparkfun, a bit too big) backlit pressure sensitive pads? I plan to use RGB leds but I don't yet know if i'm going with smd or through hole components.

xndr on the monome forum mentioned that we could use 2 boards, one for the leds and one for the buttons, and have holes on the top one (buttons matrix) to put the leds through.

For the pressure sensitivity, I wanted to use piezo transducers, but it'll be hard to find ring shaped piezos, so I guess I'll go with pezoresistive fabric (http://www.eeonyx.com/prodte.html). I got an email from Adrian Freed, CNMAT Berkeley, who used it to "bend" sparkfun's & monome buttons pad and add pressure sensitivity.

For the leds, I plan on using 12-channels 12bit PWM chips like Linear LT3595 or TI TLC5940. Still have to order those and understand how they work. Might be a lot easier that trying to deal with MAX7221 and some software kind of PWM.... This would have been a real pain in the a..

As usual, I'll keep you posted ^^
26  Forum 2005-2010 (read only) / Syntax & Programs / Re: monome protocol on: May 28, 2008, 12:37:14 pm
Hi there
Just to keep you posted.
Buttons presses work, it's ok, I need now to work a bit on the hardware as I use a pin for each button (ugly wiring ^^). I'll have to do a matrix for this.
I just finished my prototype max/msp patch to send rgb intensity to the arduino, but I think i'll need to modify the monomeserial source code and extend the monome protocol to have it relay the new message type (/rgb x y r g b) to the arduino.
Cheers
27  Forum 2005-2010 (read only) / Syntax & Programs / Re: monome protocol on: May 17, 2008, 08:07:43 am
By the way, to have your arduino recognized as a monome by monomeserial, you have to change the FTDI chip ID.
To do that, you have to install Mprog and the D2XX drivers from FTDI (your arduino will still work with the arduino IDE with this drivers)

MProg 3.0 > http://www.ftdichip.com/Resources/Utilities.htm
D2XX Drivers > http://www.ftdichip.com/Drivers/D2XX.htm

1/ Install both, then run Mprog
2/ Launch Mprog, then click on Device / Scan. You should see something like this appearing in the box down.
Code:
Number Of Blank Devices = 0
Number Of Programmed Devices = 1
3/ Click on Tools > Read and Parse. This will fill the boxes.
4/ Check the "use fixed serial number" box and change the value below.
To have your board recognized as a monome by monome serial, you have to enter something like
m40h-xxx
m64-xxxx
m128-xxx
m256-xxx
Choose whatever you want, I'm not sure what is different between the various IDs, for the moment I'm using m40h-001.
There is 2 protocols described on the monome site, and the 64/128/256 seems to be more complete (15 message IDs, 9 for the 40h protocol), so maybe you'd better use m256-xxx ^^
5/ Click on File > save as
6/ Once saved, click on the flash icon (Program all existing devices, Ctrl+P).
7/ Unplug / plug back your board from the usb port.
7/ Run monomeserial, you should see something appear on the devices list.

Good luck
28  Forum 2005-2010 (read only) / Syntax & Programs / Re: monome protocol on: May 17, 2008, 07:52:43 am
Found the problem. Based on what I read on other sites (monome forum, tinct blog, etc...) I started a Serial.begin with a speed of 9600. By looking into the various max patches, I found that It must be 115200.

So, for anyone interested, you can send button states this way
Code:
int address = 0; // message ID, in this case, button state
int state = 0; // 0 (keyUp) or 1 (keyDown)
int x = 4; // x position
int y = 2; // y position
Serial.print((address << 4) | (state & 0x0F), BYTE);
Serial.print((x << 4) | (y & 0x0F), BYTE);

Thanks again kylek, I'll try to extend this to the other type of messages (ADC, ledOn/Off, etc... ) and make it a proper library ^^
29  Forum 2005-2010 (read only) / Syntax & Programs / Re: monome protocol on: May 17, 2008, 07:40:09 am
Ok, with a print object in the monome_test patch, I can see that max/msp is receiving commands from my arduino. Now I just have to figure the good syntax, as monomeserial always sends /test/press 0 0 0 whatever I do...
Keep you posted
30  Forum 2005-2010 (read only) / Syntax & Programs / Re: monome protocol on: May 17, 2008, 06:31:34 am
Hi KyleK
Thanks for replying. I tried your method, it should work but I guess I'm having another problem, as monomeserial recognize my arduino board as a 40h but the monometest max patch doesn't show me anything. I must first check that I can get anything (even noise) going between the arduino & max/msp before going further with the protocol ^^
Thanks

I'll keep posted.

Bye
Pages: 1 [2] 3 4 ... 25