Sub DrawLights(Lights As String)
Dim rc, yc, gc As Int
If Lights.SubString2(0, 1) = "R" Then rc = Colors.Red Else rc = Colors.Black
If Lights.SubString2(1, 2) = "Y" Then yc = Colors.Yellow Else yc = Colors.Black
If Lights.SubString2(2, 3) = "G" Then gc = Colors.Green Else gc = Colors.Black
Canvas1.DrawCircle(40dip, 200dip, 30dip, rc, True, 10dip)
Canvas1.DrawCircle(40dip, 280dip, 30dip, yc, True, 10dip)
Canvas1.DrawCircle(40dip, 360dip, 30dip, gc, True, 10dip)
Activity.Invalidate
End Sub
Sub DrawLights2(Lights() As Boolean) 'array of booleans
Dim rc, yc, gc As Int
If Lights(0) Then rc = Colors.Red Else rc = Colors.Black
If Lights(1) Then yc = Colors.Yellow Else yc = Colors.Black
If Lights(2) Then gc = Colors.Green Else gc = Colors.Black
Canvas1.DrawCircle(40dip, 200dip, 30dip, rc, True, 10dip)
Canvas1.DrawCircle(40dip, 280dip, 30dip, yc, True, 10dip)
Canvas1.DrawCircle(40dip, 360dip, 30dip, gc, True, 10dip)
Activity.Invalidate
End Sub