Discussion:
control real world devices - how?
(too old to reply)
Mike
2011-08-10 02:21:08 UTC
Permalink
Back in the 90s I used to code in Atari Basic. I could use the
joystick port to control things (basically turn a led light on or off
to trigger things).

Can I use a port like that in VB? I have a project and need pointers
on how to go about coding this. Atari used the peek and poke commands.
But you had to know the mem address for the port.

I am useing VB 5 (sorry), but any help?

Mike
Gloops
2011-08-10 07:43:32 UTC
Permalink
Post by Mike
Back in the 90s I used to code in Atari Basic. I could use the
joystick port to control things (basically turn a led light on or off
to trigger things).
Can I use a port like that in VB? I have a project and need pointers
on how to go about coding this. Atari used the peek and poke commands.
But you had to know the mem address for the port.
I am useing VB 5 (sorry), but any help?
Mike
Hello,

It seems it would be a good idea to precise what LED you speak about.

By standard you have three LEDs on your keyboard, to show the state of
the keyboard, more precisely the bits for caps lock, num lock, and
scroll lock. There is also a bit for the insert mode, to take just one
example, but by standard there is no LED for that. To manage that, you
can use the APIs GetKeyboardLayout and SetKeyboardLayout. The results
also depends on the machine, I remember machines with which the
reactions of the keyboard were well managed, but not the states of the
LEDs, which then could reflect the opposite of the state of the keyboard
(LED on as the lock was off, and when you pressed the key, the
opposite). I imagine such machines do not work any more, but I must
admit I did not test that recently.

If you are speaking about an external device, for sure there must be
another protocol to know about, maybe knowing about the device can help.
Mike
2011-08-10 14:00:59 UTC
Permalink
Post by Gloops
Post by Mike
Back in the 90s I used to code in Atari Basic. I could use the
joystick port to control things (basically turn a led light on or off
to trigger things).
Can I use a port like that in VB? I have a project and need pointers
on how to go about coding this. Atari used the peek and poke commands.
But you had to know the mem address for the port.
I am useing VB 5 (sorry), but any help?
Mike
Hello,
It seems it would be a good idea to precise what LED you speak about.
By standard you have three LEDs on your keyboard, to show the state of
the keyboard, more precisely the bits for caps lock, num lock, and
scroll lock. There is also a bit for the insert mode, to take just one
example, but by standard there is no LED for that. To manage that, you
can use the APIs GetKeyboardLayout and SetKeyboardLayout. The results
also depends on the machine, I remember machines with which the
reactions of the keyboard were well managed, but not the states of the
LEDs, which then could reflect the opposite of the state of the keyboard
(LED on as the lock was off, and when you pressed the key, the
opposite). I imagine such machines do not work any more, but I must
admit I did not test that recently.
If you are speaking about an external device, for sure there must be
another protocol to know about, maybe knowing about the device can help.
Thanks.
I was hoping to use the joystick port, serial port, or com port. I
have to be able to read data coming from the port as well.

My device is all being home made....

I want to create an app in vb (version 5 - sorry). This app would be
used to control a chick incubator.
I need to do:
1) Read the temperature (I have a probe thermometer I would use the
thermal resistor from it) - this would basically be a resistance value
that I would then convert to a temperature value by math.

2) Either A) control a LED light (on or off) - OR - control a relay
switch. Either one would be used to control the incubator's heating
system.

3...whatever) Once I am able to control the port I can add things like
egg rotation, humidity control, etc..

That is why I need to have access to the ports. Being able to cause a
particular pin to become active or de-active.

Thanks
Mike
Gloops
2011-08-30 17:01:11 UTC
Permalink
Post by Mike
Thanks.
I was hoping to use the joystick port, serial port, or com port. I
have to be able to read data coming from the port as well.
My device is all being home made....
I want to create an app in vb (version 5 - sorry). This app would be
used to control a chick incubator.
1) Read the temperature (I have a probe thermometer I would use the
thermal resistor from it) - this would basically be a resistance value
that I would then convert to a temperature value by math.
2) Either A) control a LED light (on or off) - OR - control a relay
switch. Either one would be used to control the incubator's heating
system.
3...whatever) Once I am able to control the port I can add things like
egg rotation, humidity control, etc..
That is why I need to have access to the ports. Being able to cause a
particular pin to become active or de-active.
Thanks
Mike
Oh, sorry for the chicken, I forgot I was come here ...

Well, somewhere on codeproject.com I saw something detailed to command
LEDs on a parallel port, but if I remember well it was in C#, do not
know if it can help you.

So, with an existent peripheral you can call different functions,
following the doc. But if I understand, you want to develop your own
peripheral, so you face different problems at the same time : you have
the problems to develop the peripheral, and those to access it from a
program.

I am afraid my experience is a little short to help you efficiently.
Perhaps in a year or two I shall try to explore that domain a little
more, so if you find something useful, it would be nice to tell.

Something else I wanted to develop at a moment (but I did not have the
hardware), was a program that was able to receive impulses from an
AS400, to increase counters, for numbers of accounting documents.
Probably there are a few common aspects with what you intend to do.
Gloops
2011-08-30 17:04:35 UTC
Permalink
Post by Gloops
Well, somewhere on codeproject.com I saw something detailed to command
LEDs on a parallel port, but if I remember well it was in C#, do not
know if it can help you.
I did not remember the address, here it is.
http://www.codeproject.com/KB/cs/csppleds.aspx

Loading...