Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// Sensor pins #define sensorPower 7 #define sensorPin A0 // Value for storing water level int val = 0; void setup() { // Set D7

// Sensor pins #define sensorPower 7 #define sensorPin A0

// Value for storing water level int val = 0;

void setup() { // Set D7 as an OUTPUT pinMode(sensorPower, OUTPUT); // Set to LOW so no power flows through the sensor digitalWrite(sensorPower, LOW); Serial.begin(9600); }

void loop() { //get the reading from the function below and print it int level = readSensor(); Serial.print("Water level: "); Serial.println(level); delay(1000); }

//This is a function used to get the reading int readSensor() { digitalWrite(sensorPower, HIGH); // Turn the sensor ON delay(10); // wait 10 milliseconds val = analogRead(sensorPin); // Read the analog value form sensor digitalWrite(sensorPower, LOW); // Turn the sensor OFF return val; // send current reading }

_____________________________ I want to convert this arduino code to assembly code in pic16f877a in MPLAB PROGRAM

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions

Question

Why is integration so important in financial planning?

Answered: 1 week ago