making VB do something outside the computer

  • Thread starter Thread starter Jim Bryant
  • Start date Start date
J

Jim Bryant

I am building an 8 x 8 x 8 led cube and have most of the code i need to make it work but i can not figure out how to make VB callup a .txt (template)file to control the cube designs. Below is the code so far (some of it is in Italian i think) and the file name i want to use is; RainbowExplosion_8x8x8_bw_bit01 VER1

Public Declare Sub Out Lib "inpout32.dll" Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)\par
'--------------------------COSTANT FOR LPT1 ADDRESS--------------------------------\par
Public Const IndirizzoData As String = "&H378" 'DATA REGISTER: 8 bit\par
'-------------------------------------------------------GLOBAL VARIABLES----------------------------------------------------\par
Public StatoCubo(1 To 8, 1 To 64) As Integer 'variable that contains the actual state of cube\par
'-------------------------------------------------------------FUNCTIONS--------------------------------------------------------\par
Public Function ScriviCubo(NumeroCicli As Integer) 'function for write into cube the state stored in StatoCubo matrix\par
Dim ByteLpt As Byte\par
Dim ContaLivelli As Integer\par
Dim ContaLed As Integer\par
Dim ContaCicli As Integer\par
For ContaCicli = 1 To NumeroCicli\par
For ContaLivelli = 1 To 8\par
'set all bit of shift reg. of columns without clocking on shift reg. of layers and disabling EVER all clear pins (xx 01x _1_)\par
For ContaLed = 64 To 1 Step -1 'For ContaLed = 1 To 64\par
'SHIFT REG. LAYERS:\par
'MSB (D5) = 0 --> clock disables\par
'CENTRAL (D4) = 1 (valore=16)--> clear disabled\par
'LSB (D3) = not important\par
'SHIFT REG. LED:\par
'MSB (D2) = 0 --> clock disabled\par
'CENTRAL (D1) = 1 (valore=2)--> clear disabled\par
'LSB (D0) = StatoCubo(ContaLivelli, ContaLed)\par
ByteLpt = (0 + 16 + 0) + (0 + 2 + StatoCubo(ContaLivelli, ContaLed))\par
Call ClokkaLed(ByteLpt) 'send the value at function that give 1 clock signal to the shift reg. of columns\par
Next ContaLed\par
'SHIFT REG. LAYERS:\par
'MSB (D5) = 0 --> clock disabled\par
'CENTRAL (D4) = 1 (valore=16)--> clear disabled\par
'LSB (D3) = (if layer = 1--> 1(value=8); if layer <> 1--> 0) --> set 1 only the fist time\par
'SHIFT REG. LED:\par
'MSB (D2) = 0 --> clock disabled\par
'CENTRAL (D1) = 1 (valore=2)--> clear disabled\par
'LSB (D0) = not important\par
\cf2\fs18 \par
\cf1\fs15 If ContaLivelli = 1 Then 'if I\'19m setting the first layer I send a 1 at the shift reg. of layers, after I will send only the clock signal\par
ByteLpt = (0 + 16 + 8) + (0 + 2 + 0)\par
Else\par
ByteLpt = (0 + 16 + 0) + (0 + 2 + 0)\par
End If\par
Call ClokkaLivello(ByteLpt) 'send value to the function that give a clock signal to the shift reg. of layers\par
Call Aspetta(60000) 'calling the function for generate a delay (the cube stops flashing from 60.000 to 70.000 cycles)\par
Next ContaLivelli 'restart the cycle for setting the next layer\par
Call ClearAll 'call the function for activate clear on all shift register (switch off all leds)\par
Next ContaCicli\par
End Function\par
Public Function ClokkaLed(Valore As Byte)\par
Out Val(IndirizzoData), Val(Valore) 'clock DISABLED\par
'add 4 because I want to set at 1 the clock bit of shift register of columns for giving clock signal\par
Out Val(IndirizzoData), Val(Valore + 4) 'clock ENABLED\par
End Function\par
Public Function ClokkaLivello(Valore As Byte)\par
Out Val(IndirizzoData), Val(Valore) 'clock DISABLED\par
'add 32 because I want to set at 1 the clock bit of shift reg. of layers for giving clock signal\par
Out Val(IndirizzoData), Val(Valore + 32) 'clock ENABLED\par
End Function\par
Public Function ClearAll() 'function for enable the clear pin on all shift register\par
Dim ByteLpt As Byte\par
'enabling clear on all shift register (value=0) (xx x0x x0x)\par
ByteLpt = 0 '00 000 000\par
Out Val(IndirizzoData), Val(ByteLpt)\par
End Function\par
Public Function Aspetta(Ncicli As Long) 'function used to delay the cycle of updating the each layers\par
Dim Contatore As Long\par
Dim Contato As Long\par
For Contatore = 0 To Ncicli\par
Contato = Contatore 'assignment operation (only for do a CPU operation)\par
Next Contatore\par
End Function\cf0\fs20\par
}

I hope that helps.
If any one can help i would really appreciate it

Thank you

EggHeadCafe - Software Developer Portal of Choice
Authentication with Web Services Enhancements
http://www.eggheadcafe.com/tutorial...0-a686fe23d711/authentication-with-web-s.aspx
 
Jim said:
I am building an 8 x 8 x 8 led cube and have most of the code i need to make it work but i can not figure out how to make VB callup a .txt (template)file to control the cube designs. Below is the code so far (some of it is in Italian i think) and the file name i want to use is; RainbowExplosion_8x8x8_bw_bit01 VER1

Code:
[/QUOTE]

This is a VB.Net (2002-2008) group. Do you expect this code to work in VB.Net? If you use VB6 or
below, try it in the appropriate microsoft.public.vb.* group. There you should also explain
what you mean with "how to make VB callup a .txt (template)file".

BTW, functions are expected to return a value. Otherwise write a Sub.
 
in case you have not figured it out i have no idea what i am talking about, i had no idea there was a difference between VB and VB.net. The code was given to me and was told it worked, i am using 4 different versions of VB on 4 different machines. I apologise if i have offended you, it was not my intention. Please try to be tolerant with us ignorant little pissants, remember there was a time in your own life when you didnt know everything there is to know either



Armin Zingler wrote:

Jim Bryant schrieb:This is a VB.Net (2002-2008) group.
04-Nov-09

Jim Bryant schrieb

This is a VB.Net (2002-2008) group. Do you expect this code to work in VB.Net? If you use VB6 o
below, try it in the appropriate microsoft.public.vb.* group. There you should also explai
what you mean with "how to make VB callup a .txt (template)file"

BTW, functions are expected to return a value. Otherwise write a Sub

-
Armin

Previous Posts In This Thread:

EggHeadCafe - Software Developer Portal of Choice
RemoteSoft Decompiler,Obfuscator, Protector
http://www.eggheadcafe.com/tutorial...0b-1cd879a04420/remotesoft-decompilerobf.aspx
 
Jim said:
in case you have not figured it out i have no idea what i am talking about, i had no idea there was a difference between VB and VB.net. The code was given to me and was told it worked, i am using 4 different versions of VB on 4 different machines. I apologise if i have offended you, it was not my intention. Please try to be tolerant with us ignorant little pissants, remember there was a time in your own life when you didnt know everything there is to know either

I don't understand why you apologize or think that you offeneded anyone. No need to do so. As well I
don't see why I've shown any indication of intolerance. But I'm not a native English speaker, so
maybe I am not able to see it.
 
That code does not seem to contain any reference to a template file for
controlling the device. This information might be in the array StatoCubo,
and perhaps the text file is used to populate that array, but there is no
code here to do that. If that's the case, then the template will be a list
of 8 integers followed by a list of 64 integers, but many more details about
the device would be required in order to understand how these numbers relate
to the device functions, and how the array should be populated from teh
template file.

It appears to be VB6 code, because the array numbering starts at 1. It
requires the inpout32.DLL in order to communicate with the device through
port 378, which from memory is the parallel printer port.
 
Armin said:
I don't understand why you apologize or think that you offeneded anyone. No need to do so. As well I
don't see why I've shown any indication of intolerance. But I'm not a native English speaker, so
maybe I am not able to see it.

Your post sounded resonable to me. The original post implied the code
was theirs, not that the code was given to them. Had they said it was
given to them, and they are new to coding, you may have phrased your
response somewhat differently.
 
The original post implied the code was theirs . . .

No it didn't. I think you need to brush up on your English comprehension.
The original poster said:

"Below is the code so far (some of it is in Italian i think) . . . "

That statement clearly implies that the code is NOT theirs!

To the OP: Your "code" is full of RTF tags, so the first thing I would do if
I were you would be to go back to where you got it from and get yourelf a
clean copy, or manually remove the tags before you begin to analyse it or
attempt to use it. Also, it would be helpful if you were to say whether you
are using the real Visual Basic or the imposter, since the original code
probably won't work in the imposter.

Mike
 
Back
Top