Question
Can you please convert my C++ code to Pseudocode. its for an arduino project. const int hot = 28; //set hot parameter const int cold
Can you please convert my C++ code to Pseudocode. its for an arduino project.
const int hot = 28; //set hot parameter const int cold = 20; //set cold parameter void setup() { pinMode(A2, INPUT); //sensor pinMode(13, OUTPUT); //blue pinMode(12, OUTPUT); //GREEN pinMode(11, OUTPUT); //red pinMode(2, OUTPUT); //blue pinMode(3, OUTPUT); //Orange pinMode(4, OUTPUT); //red Serial.begin(9600); } void loop() { int sensor = analogRead(A2); float voltage = (sensor / 1024.0) * 5.0; float tempC = (voltage - .5) * 100; float tempF = (tempC * 1.8) + 32; Serial.print("temp: "); Serial.print(tempC); if (tempC < cold) { //cold digitalWrite(13,HIGH); digitalWrite(12,LOW); digitalWrite(11,LOW); Serial.println(" It's Cold."); } else if (tempC >= hot) { //hot digitalWrite(13,LOW); digitalWrite(12,LOW); digitalWrite(11,HIGH); Serial.println(" It's Hot."); } else { //fine digitalWrite(13,LOW); digitalWrite(12,HIGH); digitalWrite(11,LOW); Serial.println(" It's Normal."); } delay(10); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started