2896| 1
|
[求助] 求助各位大佬我想用4个npn晶体管改变电流方向 |
代码图片链接如下,请问我怎么改才可以通过这四个能起到改变电流方向的目的,虽然我也想用h桥:( int temp = 0; int Tempstatus; int right=3; int left=2; float voltage; float TempCelcius; void setup () { Serial.begin(9600); pinMode (temp,INPUT); pinMode (right,OUTPUT); pinMode (left,OUTPUT); } void loop () { Tempstatus = analogRead (temp);//Math functions to converse analog signal to voltage signal voltage = (Tempstatus/1023.0)*5.0; TempCelcius = (voltage-0.5)*100.0; if (TempCelcius >= 10 && TempCelcius <40) {digitalWrite(3,LOW); digitalWrite(2,LOW); } if (TempCelcius >= 41 && TempCelcius <=49) {digitalWrite(3,LOW); digitalWrite(2,LOW); } if(TempCelcius >= 50) {digitalWrite(3,LOW); digitalWrite(2,HIGH); } if (TempCelcius < 10) {digitalWrite(3,HIGH); digitalWrite(2,LOW); } } https://www.tinkercad.com/things/3IixNxH9IzG-surprising-jaagub-habbi/editel?sharecode=O9vJ7ZEk-tq1WB35KuQ_Zosx4q6UO-S0ahi5dae2UoA |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed