A distance meter has been programmed Meet: a) What is the problem with this code b) Implement a new feasible code in ARDUINO const int pingPin = 5; #include const int ledPin = LED_BUILTIN; void setup() { Serial.begin(9600); pinMode(ledPin, OUTPUT); } void loop() { int cm = ping(pingPin); Serial.println(cm); digitalWrite(ledPin, HIGH); delay(cm * 10); digitalWrite(ledPin, LOW); delay (cm * 10); }
Q: 16) For the circuit that is shown in the Figure shown below. LG represent logic circuit with the…
A: Firstly lets solve x1,x2 at LG let's assume it's out put as Y1 and at x4, x5 as Y2 as shown in the…
Q: Question 41 Given the problem of basic multiplication: Input: Two n-digit nonnegative integers, x…
A: Time Complexity: Overall effectiveness of any multiplication or addition can be determined by its…
Q: Write in the programming language Python a pushdown automaton simulator (a program that simulates a…
A: The regular expression for the language is a(a+b)*a + b(a+b)*b If the string starts with a then it…
Q: Write a C program for the following operations. 1. Atthe default frequency of MCLK=1 MHz, generate 5…
A: Answer: Our instruction is answer the first three part from the first part and I have done code…
Q: ing program using LOOP instruction: MOV AL,X MOV BL,X INC DL ADD AL,X INC DL ADD AL,X INC DL…
A: using emu8086: Rewrite the following program using LOOP instruction: MOV AL,X MOV BL,X INC DL ADD…
Q: Instruction: Solve the following problems using Python (py or ipynb) or MatLab (m). Submit your code…
A: We need to write a Python code for the given scenario. *** As per the guidelines only 1st question…
Q: Plot a graph for the following polynomials each with x=-100 to +100 with a change in x as 0.2 ) flx)…
A: Polynomial A: Polynomial B: Polynomial C:
Q: Please construct a pushdown automaton (PDA) for the following language and please briefly describe…
A: It is defined as a 7-tuple (Q, sigma, S, transition, q0, I, F) where : Q is the finite number of…
Q: Write a C program that proceed exactly in this order: 1. The main(parent) process creates a children…
A: code:
Q: In this program you calculate n to the power of k, p = n*. This is done by repetitive…
A: Solution: .MODEL SMALL.DATA BASE DB ? POW DB ? NL1 DB…
Q: implement the pseudocode in C++ (i.e., only implement the code, no variable declarations, etc. are…
A: Step 1 : Start Step 2 : In the main function , Define a for loop which starts from the value of i =…
Q: Please change this C code to Assembly program(x86 and ARM assembly gcc) #include int main() {…
A: We have a C language program to find prime numbers to a range. We need to convert this C language…
Q: SVML is a banner marketing term that encompasses all Intel SIMD features SVML is a library that uses…
A: The Intel® C++ Compiler provides short vector math library (SVML) intrinsics to compute vector math…
Q: # Solve it with C programing On a bus, there are N number of passengers sitting on their seats…
A: The program is based on the arrays hence declare an array of size N. Initially, read size of the…
Q: The following JAVA program is translated to LC3 assembly language. for (i=0, i<10, i++){ A[i] = 0; }…
A: Question :- Which register points to array A elements?
Q: Translate the following C++ program into MIPS assembly language Run it 3 times in the MARS…
A: Below is the assembly code for given C++ code:
Q: Problem 4. Suppose a program for a racing drone consists of a purely sequential part which takes 25…
A: Loop takes 100 cycles Iterated loop takes 100 times
Q: You need to implement full adder, full subtractor and 8x1 mux by using the half adder, half…
A: We will implement solved this question in verilog language. Below is the solution.
Q: Example · Using AVR microcontroller, write a code for a servomotor. V The servomotor (PCO) is…
A: According to the information given:- We have to write code for the servomotor using AVR…
Q: A pincode consists of N integers between 1 and 9. In a valid pincode, no integer is allowed to…
A: 1. declare function pin code check a. create empty array for repPos b. create…
Q: Write an assembly program that rearrange elements A in reverse order as follows : (note: SI and DI…
A: Lets see the solution.
Q: Question (2): The ackermann function is one of those very difficult functions to compute and it's a…
A: The C++ code is as follows:- #include <iostream>using namespace std;int ack(int m,int n)…
Q: Name your program Burrovskheeler.java and organize it using the following API: publie elass…
A: import java.util.ArrayList; import java.util.List; public class BWT { private static final…
Q: Given x=[4 3 2 1;1 2 3 4; 5 6 7 8; 9 10 11 12; 13 14 15 16] has been assigned, what would be the…
A: In this, we have given a MATLAB code. We will run this code. And in the end, we will paste the code.
Q: Answer in C++, show example output please There are three buckets size X, Y, M (1<=X<=Y<=M). All…
A: Answer is given below-
Q: By implementing the concepts of Classes and Objects, write a C++ program that converts the value of…
A: #include<iostream>using namespace std; class Wye2Delta{ private: double R1,R2,R3; public:…
Q: Give the tilde approximations and explain for the following quantities. a) 1+(1/?^3) b)…
A: As per the company guideliness we are supposed to answer only 3 options. Kindly repost the other…
Q: Implement the following C code in MIPS assembly. The Fibonacci sequence is a series of numbers,…
A: ANSWER;-
Q: ... 7. Translate the pseudocode in Section 2.4 for computing the number of tiles and the gap width…
A: Below is the modified Java code: - Explanation: - In the given code, when the variable gap is…
Q: Convert this C code into MIPS Assembly Language #define WINNER_NONE 0 int check_winner(void) {…
A: Given Code: #define WINNER_NONE 0 int check_winner(void) { for (int row = 0; row <…
Q: change this C code to Assembly program(x86 and ARM assembly gcc) #include int main() {…
A: .LC0: .string "Find primes up to: " .LC1: .string "%u" .LC2: .string "2"…
Q: For each of the following two code segments, decide whether it is suitable for parallel execution…
A: ANSWER: OpenMP viably takes advantage of these normal program qualities, so it is very simple to…
Q: C programming language supports left-shift and right-shift operators. This Arduino sketch tests both…
A: Hey there, I am writing the required solution of the questin mentioned above. Please do find the…
Q: If the port A, B, C address of 8255 IC are 38H, 3AH, 3CH and its are configured as port A is an…
A: Answer: I have given answered in the handwritten format in brief explanation.
Q: The following JAVA program is translated to LC3 assembly language. for (i=0, i<10, i++) { A[i] = 0;…
A: Loop explanation: Mnemonics…
Q: In Python write out the Python Code for the following in Jupiter Lab. Show code and outputs. Use a…
A: We choose the titanic dataset from the seaborn package. The jupyter notebook for the pivot table…
Q: matrix addition is pretty simple; see the program below. However, the given addition function…
A: It is defined as Central Processing Unit. The CPU is the primary component of a computer that…
Q: Write a code in sim8085 for the following problem: The pressure of two boilers is monitored and…
A: assembly language, sometimes abbreviated asm, is any low-level programming language in which there…
Q: Magnus Carlson has N jars of pickle. They are numbered from 1 to N while ith jar contains A¡ units…
A: Given and Required:
Q: Implement the following C++ program in MIPS, upload the MIPS source code and the screenshot of…
A: Here is the source code of the C++ Program: - int multiply(int x, int y) { int product=0;…
Q: Develop a computer code (you can use any platform of your choice; MATLAB, C, Python, Excel etc.)…
A: Here is the program using MATLAB.....tried to explain it with different values.....
Q: Write a MIPS assembly program that can draw a rectangle pattern onto the console output based on a…
A: Task : Given the height, width, border and fill character. Create the rectangle plot.
Q: Write a c program of 'Array Sum' using pthread and semaphore such that each process needs to spend 5…
A: Given: Write a c program of 'Array Sum' using pthread and semaphore such that each process needs…
Q: MIPS low-level assembly Complete fib_recur function, which recursively calculates the Fibonacci…
A: Answer: MIPS Code : fibonacci_recur function, that recursively calculates the Fibonacci numbers from…
Q: wirelessly connected with each other. Problem Statement: You need to simulate a network just like…
A: CSMA access modes 1persistent: The node senses the channel, if idle it sends the data, otherwise…
Q: make this code work able instruction are given in picture #include using namespace std; double…
A: #include <iostream>#include <cmath> using namespace std; // Create a class named…
Q: Write a loop in assembly that increments each element of array x as defined in the previous problem.…
A: ; while _start: test ecx,ecx jz _done ; while ecx > 0 ; do stuff dec ecx jmp _start _done: ;…
Q: complete this on assembly lenguage. (irvine library x86) Read in x,y calculate 3x + 2y + xy – 10 =…
A: It is defined as a low-level programming language for a computer or other programmable device…
Q: A machine code before loading into the loader on pep/9 simulator is given below. Please show the…
A: Code: Assembler InputLDBA 0xFC15,d ;Input first characterSTBA 0x0013,d ;Store first…
Step by step
Solved in 2 steps
- The word "cat" can be spelled from the period table element symbols by using the sequence of elements carbon and astatine in that order. Since the symbol for carbon is "C" and the symbol for astatine is "At", which together makes [C][At]; thus, "cat" is an elemental phrase. To determine which elements can be used all combinations of 1 and 2 letter element symbols must be tested. Write a java program to determine if a lowercase word can be made with any combination of 1 or 2 letter element symbols from the periodic table. The list elements will come from a text file containing all the atomic elements and their symbols. The user will enter a lowercase word to check for from the keyboard. Assume the word is properly spelled but check for all lowercase letters. Output to the screen the list of chemical elements if it can be made from the element symbols following the format as seen below, if not output: "No element phrase possible." Output all possible solutions if applicable. Finally, ask…explain these python codes with comments , explain briefly >>> import numpy as np >>> example_input = [1, .2, .1, .05, .2] >>> example_weights = [.2, .12, .4, .6, .90] >>> input_vector = np.array(example_input) >>> weights = np.array(example_weights) >>> bias_weight = .2 >>> activation_level = np.dot(input_vector, weights) +\ ... (bias_weight * 1) >>> activation_level 0.674 With that, if you use a simple threshold activation function and choose a threshold of .5, your next step is the following: >>> threshold = 0.5 >>> if activation_level >= threshold: ... perceptron_output = 1 ... else: ... perceptron_output = 0 >>> perceptron_C++ Given an integer num, repeatedly add all its digits until the result has only one digit, and return it. Example 1: Input: num = 38 Output: 2 Explanation: The process is 38 --> 3 + 8 --> 11 11 --> 1 + 1 --> 2 Since 2 has only one digit, return it. Example 2: Input: num = 0 Output: 0 Constraints: 0 <= num <= 231 - 1 Follow up: Could you do it without any loop/recursion in O(1) runtime? //code here class Solution {public: int addDigits(int num) { }}; //
- write a Java Netbeans codes and provide output screenshots of the Netbeans Designs. check bellow codes required to be followed in the question. GrossSalary=BASICPAY+HRA+TA+DA+BONUS+MEDICAL+EDUCATION ALLOWANCE 5000 TAX=30% of Grosssal 30/100*Gross =1500 ro Netsal= grosssalary-Tax 5000-1500=3500 If(gross>=5000) Tax=(0.3)*gross Else If (gross>=3000 && gross<5000) Tax=20% of gross If(gross>=1500 && gross <3000) Tax=5* of gross Else Tax=0.0my code is getting errors and i cant figiure out why , can you check my code and help me fix the errors . written in c code. It needs to print out a maze and as you hit enter you go through the maze. #include <stdio.h>#include <stdlib.h> #define XSTART 2#define YSTART 0 #define DOWN 0#define RIGHT 1 #define UP 2#define LEFT 3 void mazeTraverse(char maze [12][12],int xCor,int yCor,int dir);int checkForEdge(int x , int y);int correctMoves (char maze[][12],int r , int c );void displayMaze (char maze [][12]); int main (void){ char maze [12] [12] ={{'#','#','#','#','#','#','#','#','#','#','#','#'}, {'#','.','.','.','#','.','.','.','.','.','.','#'}, {'.','.','#','.','#','.','#','#','#','#','.','#'}, {'#','#','#','.','#','.','.','.','.','#','.','#'}, {'#','.','.','.','.','#','#','#','.','#','.','.'}, {'#','#','#','#','.','#','.','#','.','#','.','#'}, {'#','.','.','#','.','#','.','#','.','#','.','#'}, {'#','#','.','#','.','#','.','#','.','#','.','#'},…write in C for a STM32F446RE microcontroller Write a source library that contains the with the following public functions: void keypadInit(void); /Initiallized the GPIO to read the keypad. uint16_t readKeypad(void); //Returns the state of all of the keypad buttons in the return value at the moment the function is called. void decodeKeypad(uint16_t, char *); //Takes the state of the keypad and returns (by reference) an array of the key's pressed. The library should work with the following main: int main (void) { uint16_t key; char carray[17]; keypadInit(); while(1) { while(!(key = readKeypad())); /*Get which keys pressed*/ decodeKeypad(key, carray); /*What are those keys*/ printf("%s\n",carray); /*Print those keys to screen*/ while(readKeypad() == key); /*Wait for the keypad to change*/ }} Problem 1: Write a library that works with the following pin assignments Row 0 -> PC0 Row 1 -> PC2 Row…
- In java pls! Thank you! In many cryptographic applications the Modular Inverse is a key operation. This programming problem involves finding the modular inverse of a number. Given 0 < x < m, where x and m are integers, the modular inverse of x is the unique integer n, 0 < n < m, such that the remainder upon dividing x × n by m is 1. That is, x × n mod m = 1. Modular inverse is a concept that extends the arithmetic inverse. For example, the inverse of 2 is ½ because 2 x ½ = 1 with decimal operation. Here the inverse number can be a fraction. In modular inverse, we only allow integers, no fraction. So not all integer has an inverse. For example, m = 26, x = 3, the modular inverse of 3 is 9 because 3 x 9 mod 26 = 1. However, m = 26, x = 2, the modular inverse of 2 does not exist because you cannot find a number y so that 2 x y mod 26 = 1. Here is another example, m = 17, 4 x 13 = 52 = 17 x 3 + 1, so the remainder when 52 is divided by 17 is 1, and thus 13 is the inverse…Problem Statement: Consider a permutation of numbers from 1 to N written on a paper. Let’s denote the product of its element as ‘prod’ and the sum of its elements as ‘sum’. Given a positive integer N, your task is to determine whether ‘prod’ is divisible by ‘sum’ or not. Input Format: First input will be an integer T. It depicts a number of test cases. Followed by the value for each test case. Each test case will contain an integer N (1<= N <=10^9). It is nothing but the length of the permutation. Output Format: For each test case, print “YEAH” if ‘prod’ is divisible by ‘sum’, otherwise print “NAH”..Please written by computer source Question 1: Suppose we wish to write a procedure that computes the inner product of two vectors u and v. An abstract version of the function has a CPE of 14–18 with x86- 64 for different types of integer and floating-point data. By doing the same sort of transformations we did to transform the abstract program combine1 into the more efficient combine4, we get the following code: Our measurements show that this function has CPEs of 1.50 for integer data and 3.00 for floating-point data. For data type double, the x86-64 assembly code for the inner loop is as follows: Assume that the functional units have the characteristics listed in Figure 5.12. **See last page for figures A. Diagram how this instruction sequence would be decoded into operations and show how the data dependencies between them would create a critical path of operations, in the style of textbook Figures 5.13 and 5.14. vmovsd vmovsd vmulsd vaddsd | | | |…
- I need to write a recursive Java program to count the number of muck-free regions in a lagoon. The Lagoon is represented by a rectangle of N x M squares. Each square contains either muck ('M') or sand ('.'). A region is defined as a connected set of one of more squares with sand in it, where a square is considered to connect to all eight of its adjacent squares. Sample input/output is shown in picture attachedQuestion 2: You are given a grid of size N x N where each cell contains a non-negative integer. You need to find the maximum sum of a path from the top-left corner to the bottom-right corner. You can only move to the right or down from each cell. Apply a dynamic programming algorithm to solve this problem and explain your approach 1. Write a text explanation of your solution in a step by step. 2. Provide a Java solution code of your proposed solution and run it on the following input int grid={(1, 3, 1}, {1, 5, 1}, {4, 2, 1}};1: |R|←|P| Reserve space for |P| = 13 values.2: x ← n3: for i ← 0 ...(|P| − 1) do4: c ← x div Pi Number of multiplicands Pi in x.5: Ri ← c6: x ← x − c · Pi7: end for8: return RA Java programmer could implement Algorithm by first modelling the primitivenumbers with the enumeration type RomanNumeral. Each enum constant (I, IV, ..., M) is declared with its decimal value, which can be accessed with the function getValue().