Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The code below is running on an Arduino board. Pin 3 is connected to a signal generator that is producing a 33Hz square wave at

image text in transcribed

The code below is running on an Arduino board. Pin 3 is connected to a signal generator that is producing a 33Hz square wave at 5V amplitude. Determine how many times the LED connected to pin 13 will flash on during each 10 second interval. For full credit, you must explain how this is determined and show some math. Note that there is a timer interrupt in this code, a pin interrupt in this code, and some polling code in loop(). #include bool inval; bool lastval = false; void setup() { // Initialize the digital pin as an output. // Pin 13 has an LED connected on most Arduino boards pinMode(13, OUTPUT); pinMode(3, INPUT); 5 Timeri.initialize (33333); // set a timer of length 33333 useconds (or 0.033333 sec) Timeri.attachInterrupt( timerIsr); attachInterrupt (digitalPinToInterrupt (3), pulseIsr, FALLING); } void loop() { inval - digitalRead(3); if ((inval != lastval) && (inval == true)) { digitalWrite(13, digitalRead( 13 ) ^ 1); 1 lastval = inval; } ISR Timer Routine void timerIsr() { // Toggle LED digitalWrite( 13, digitalRead( 13 ) ^ 1); } /// /// ISR Pin 3 Routine void pulseIsr() { // Toggle LED digitalWrite(13, digitalRead( 13 ) ^ i); }

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

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago