Aber nicht bei mir - er schaltet nich zurück sondern auf 0
Also ich habe nun:
Case 10 To 24
Pwm1 = 0
dazugeschrieben und die
Case Else
Pwm1 = 0
habe ich weggelassen. Warum hat er denn die Else Schleife nicht genommen?
Code:
$regfile = "m8def.dat" 'AT-Mega8
$crystal = 1000000 'Quarz: 1 MHz
$baud = 2400 'Baudrate der UART: 2400 Baud
'===============================================================================
' Variablen
'===============================================================================
Dim Result As Word
Dim Ohm As Single
Dim Temp1 As Single 'wegen den negativen Zahlen!!!
Dim Temp2 As Single
Dim Temp3 As Single
Dim Temp As Single
Dim Pwm1 As Byte
Config Portc = Input
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Start Adc
'-------------------------------------------------------------------------------
'Programm:
'-------------------------------------------------------------------------------
Do
Result = Getadc(1)
Ohm = 2.0238 * Result
Temp1 = Log(ohm)
Temp2 = Temp1 + 5.59017600439636
Temp3 = 3730 / Temp2
Temp = Temp3 - 273
Print "Temp: " ; Fusing(temp , "###.#" ) ; "°C"
Wait 1
Select Case Temp
Case 10 To 24
Pwm1 = 0
Case 25 To 29
Pwm1 = 25
Case 30 To 34
Pwm1 = 50
Case 35 To 39
Pwm1 = 75
Case Is > 40
Pwm1 = 100
'Case Else
' Pwm1 = 0
End Select
Print "PWM1: " ; Pwm1
Loop
End
Lesezeichen