2022-2-14 09:41:11 [显示全部楼层]
264浏览
查看: 264|回复: 0

[求助] 求助各位大佬我想用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);
  }
}
MonFebruary-202202146589..png
https://www.tinkercad.com/things/3IixNxH9IzG-surprising-jaagub-habbi/editel?sharecode=O9vJ7ZEk-tq1WB35KuQ_Zosx4q6UO-S0ahi5dae2UoA

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2022 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail