Show Posts
Pages: [1]
1  Using Arduino / LEDs and Multiplexing / Re: LEDs as sensors, newbie needs help! on: January 30, 2013, 09:29:01 am
Hi everyone, I have been unactive due to sickness (someone actually coughed in my face and it was downhill from there).

Thanks for the advice (and to dhenry!) I'm on it.

I've had a bit of fun with a 10 segment display (http://www.maplin.co.uk/10-segment-display-2128) and Mike's code, giving ok results.

What I need to do now is be able to locate something the shape of a ping-pong ball falling on a 50x50mm surface. I'm going to search which sensor (phototransistor, or led) does this best and how to process data to locate it. FUN TIMES (I'm actually looking forward to it smiley)

The aim later is to have a large horizontal surface, an led or led-phototransistor array, with points appearing in a cluster (leds) and a kid aiming a ping pong ball at it, with the array recording how accurate his throw was. (It's for kids who've suffered strokes, hand-eye coordination + fun + aim)

Hope it's not too much info. anyway, thanks for the support, it's awesome! smiley
2  Using Arduino / LEDs and Multiplexing / Re: LEDs as sensors, newbie needs help! on: January 24, 2013, 05:44:24 am
P18F4550, Hippynerd, Grumpy_Mike,

Thanks a lot for pointing it out to me, I'm following Grumpy_Mike's example and it works, although results sometimes flicker heavily, with a 10 segment display I bought yesterday (http://www.maplin.co.uk/10-segment-display-2128). Might have been because it was night and there wasn't any 'natural' light.
Grumpy_Mike, thank you for posting both the arduino and the processing code, I'm deciphering it slowly! smiley

I've been told that to achieve my purpose, it would be better (and less complicated) to use a phototransistor in the middle of collated 2x2 or 4x4 arrays for location of a finger quickly touching the screen. If you've got any thoughts, please shoot! smiley

Best,

Ymtees
3  Using Arduino / LEDs and Multiplexing / Re: LEDs as sensors, newbie needs help! on: January 23, 2013, 04:44:00 am

Anyone giving you a piece of code is doing you a disservice. Go figure out what mechanism is at work and how to perform the various functions needed in your mcu.

That's called learning.

Copy-and-paste is for people without a brain.


I understand I may be sounding as though I want someone to do the work for me, sorry about that, I am keen to learn but am afraid lack of guidance makes it seem as though there is a world I need to understand before I can do the smallest things. A piece of code, which I can decipher, would help me learn as I tweak it, making the whole processing more interactive, focused, and relevant to what I am trying to learn.

Thank you for your reply.

Ymtees
4  Using Arduino / LEDs and Multiplexing / LEDs as sensors, newbie needs help! on: January 22, 2013, 07:15:02 pm
Hello,

I'm currently working on an interface using the bi-directionality of an LED array. They would display a target which the finger has to touch and sense it to locate if the target has been accurately touched...

I have watched Han's video (http://cs.nyu.edu/~jhan/ledtouch/index.html) and have looked at patents for using leds as sensors, but unfortunately I'm quite new to all of this and am a bit lost...

If by any chance you know of a program that does the same thing (array of led translated to screen) or that you have it as 'old work' and that you have moved on to something else, could you please point to me where I could find them?
This kind of thing is very helpful (for anyone who is interested) http://www.provolot.com/projectlog/2007/05/bidirectional_led_sensing_proc.html

I've got very limited knowledge of processing (and arduino coding in general) and a few lines of working code would therefore help me greatly.

with best wishes,

Ymtees
5  Using Arduino / LEDs and Multiplexing / Re: Programming Hourglass to start once last LED is reached on: January 03, 2013, 10:59:42 am
Thanks for your reply, here's the code

Code:
// Every ten seconds, a light goes on.
//After all the lights have been turned on, it starts again.
//if the switch is tilted, it starts again.

const int switchPin = 8;
unsigned long previousTime=0; // variable to hold the time
int switchState =0;    // define time for comparison.
int prevSwitchState =0;

int led = 2; // variable created to know which pin to start from

long interval = 1000; // interval between each LED turning on



void setup (){
 pinMode (switchPin, INPUT);
 
 for (int x=2; x<8; x++){
  pinMode(x,OUTPUT);
  }
}

void loop () {
  unsigned long currentTime = millis();
 
  if(currentTime - previousTime > interval) {
  previousTime = currentTime;
 
  digitalWrite(led,HIGH);
  led++;
 
   // When the LED on pin 7 is turned on, the whole process starts with all lEDs turned off
  if(led == 9) {
    for(int x = 2; x < 8; x++){
    digitalWrite(x, LOW);
  }
 
  led = 2;
  previousTime = currentTime;
  }
 
}
 
  switchState = digitalRead(switchPin);
if(switchState != prevSwitchState){
  for(int x =2; x<8; x++){
    digitalWrite(x, LOW);
  }
 
  led = 2;
  previousTime = currentTime;
}

prevSwitchState = switchState;
}
6  Using Arduino / LEDs and Multiplexing / Programming Hourglass to start once last LED is reached on: January 03, 2013, 10:37:47 am
Hello, this is my first post,

I'm successfully getting my 'hourglass' (made up of 6 LEDs and a tilt switch) to start again once the last LED has been reached, but I've had to fiddle with the programme and don't understand why.

The last led is on pin 7, but I call pin 9 for it to work...
  if(led == 9) {
    for(int x = 2; x < 8; x++){
    digitalWrite(x, LOW);
  }
 
  led = 2;
  previousTime = currentTime;
  }
 
I wonder if it is because I start on pin 2 and there is a secret, hidden, substraction of 2 going on...

It'd be great to understand it rather than just accepting that it works...

Thanks!
Pages: [1]