Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using an Arduino, create a program in C. This program should be able to read values on the provided API. The API provides private grid

Using an Arduino, create a program in C. This program should be able to read values on the provided API. The API provides private grid tariffs. Create a program that reads the values of the API, and when the tariff is below a certain point that you set, a car charger or motor should automatically turn on. Simply use a motor or diode on a breadboard to illustrate this. If the tariff never goes down to the value you set, you should be able to force start the motor with a button. This button will be on your smartphone using Blynk. Blynk can remotely control the Arduino. This is a step to make homes smarter and save energy. A LCD display should also illustrate the time and what the grid tariff is currently at if possible. Show your code, including Blynk, the breadboard and the Arduino.

The provided API: Request body Sample:

{ "range": "string", "startTime": "string", "endTime": "string", "meteringPointIds": [ "string" ] }

Schema:

{ "type": "object", "properties": { "range": { "maxLength": 10, "minLength": 0, "pattern": "yesterday|today|tomorrow", "type": "string", "nullable": true }, "startTime": { "type": "string", "format": "date-time", "nullable": true }, "endTime": { "type": "string", "format": "date-time", "nullable": true }, "meteringPointIds": { "type": "array", "items": { "type": "string" }, "nullable": true } }, "additionalProperties": false }

Code sample:

using System; using System.Net.Http.Headers; using System.Text; using System.Net.Http; using System.Web; namespace CSHttpClientSample { static class Program { static void Main() { MakeRequest(); Console.WriteLine("Hit ENTER to exit..."); Console.ReadLine(); } static async void MakeRequest() { var client = new HttpClient(); var queryString = HttpUtility.ParseQueryString(string.Empty); // Request headers client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "{subscription key}"); var uri = "https://elvia.azure-api.net/grid-tariff/api/{v}/tariffquery/meteringpointsgridtariffs?" + queryString; HttpResponseMessage response; // Request body byte[] byteData = Encoding.UTF8.GetBytes("{body}"); using (var content = new ByteArrayContent(byteData)) { content.Headers.ContentType = new MediaTypeHeaderValue("< your content type, i.e. application/json >"); response = await client.PostAsync(uri, content); } } } } 

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

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions

Question

What is Centrifugation?

Answered: 1 week ago

Question

To find integral of ?a 2 - x 2

Answered: 1 week ago

Question

To find integral of e 3x sin4x

Answered: 1 week ago

Question

To find the integral of 3x/(x - 1)(x - 2)(x - 3)

Answered: 1 week ago

Question

What are Fatty acids?

Answered: 1 week ago