Hi,
The next development of my system requires 3 outputs each to drive an LED as in the case of a red/yellow/green robot.
I have inserted the following code for each of the outputs, but get a compile eror:
If B27 = 1; Then
SetDigitalChannel (CardAddress,5);
Else
ClearDigitalChannel(CardAddress,5)
I slightly modified your code.
This seems to work:
Sub TimerProc(ByVal HWnd As Long, ByVal uMsg As Long, ByVal nIDEvent As Long, ByVal dwTimer As Long)
On Error Resume Next
InOutMode CardAddress, 0, 0 'all digital I/O terminals are now outputs
If ActiveSheet.Cells(27, 2) = 1 Then '(27,2) is cell B27
SetDigitalChannel CardAddress, 5
Else
ClearDigitalChannel CardAddress, 5
End If
End Sub
Thanks, that compiled OK.
If I want to respond to a cell in another worksheet (same file), do I have to make it the Active Sheet or can it be referenced in the VB code?
[quote]If I want to respond to a cell in another worksheet (same file), do I have to make it the Active Sheet or can it be referenced in the VB code?[/quote]Yes, you can reference the other worksheets too.
Here an example: If Sheet2.Cells(27, 2) = 1 Then
SetDigitalChannel CardAddress, 5
Else
ClearDigitalChannel CardAddress, 5
End If
I am not able to get the outputs to work - I think that I am putting the code in wrong.
Could I please email a copy of the spreadsheet for someone to look for the problem?