Compute Area and Perimeter of a Circle in Go

Rishikesh Kumar Rishi
Updated on 30-Jul-2021 15:25:58

488 Views

To compute the area and perimeter of a circle, we can take following steps −Define a struct with circle properties such as radius.Define a method to calculate the area of the circle.Define a method to calculate the perimeter of the circle.In the main method, take the user's input for circle's radius.Instantiate the circle with the radius.Print the area of the circle.Print the perimeter of the circle.Example Live Demopackage main import (    "fmt"    "math" ) type Circle struct {    radius float64 } func (r *Circle)Area() float64{    return math.Pi * r.radius * r.radius } func (r *Circle)Perimeter() float64{   ... Read More

Find Area of a Rectangle Using Classes in Go

Rishikesh Kumar Rishi
Updated on 30-Jul-2021 15:17:39

549 Views

To find the area of a rectangle using classes, we can take following StepsDefine a struct with rectangle properties such as breadth and length.Define a method to calculate the area of the rectangle.In the main method, instantiate an object of rectangle.Call the struct method, i.e., Area, to calculate the area of the rectangle.Print the area of the rectangle.Example Live Demopackage main import (    "fmt" ) type Rectangle struct {    breadth int    len int } func (r *Rectangle)Area() int{    return r. len * r.breadth } func main(){    rectangle := Rectangle{       breadth: 10,     ... Read More

5 Arduino Project Problem Statements for Beginners

Yash Sanghvi
Updated on 30-Jul-2021 15:12:31

2K+ Views

If you are starting off with Arduino, then the following 5 projects can be taken up by you −7-segment display using ArduinoInterface a 7-segment display with Arduino and count from 0 to 9 on that display. This will help you get a good understanding of GPIOsAs a next step, you can interface Arduino with a potentiometer, and display the truncated voltage value (read using ADC) on the 7 segment display.Fire Alarm SystemInterface the Arduino with a smoke detector or a flame sensor and a buzzer to give a warning as soon as the readings from the smoke detector cross a ... Read More

Popular Boards That Can Be Programmed Using Arduino IDE

Yash Sanghvi
Updated on 30-Jul-2021 15:09:56

243 Views

Here are some popular boards that can be programmed using Arduino IDE −ESP8266This board is used primarily for IoT applicationsIt has WiFi and BlueTooth capabilitiesTo make this compatible with Arduino IDE, the following JSON has to be added to File → Preferences → Additional Boards Manager URLs −Next, you need to go to Tools → Boards Manager, search for ESP8266 and install this board.ESP32This is an upgrade over ESP8266It comes with two cores (supporting dual core operation) and in general has superior specs over ESP32There are various variants of this board, some like the TTGO Board even having OLED, LoRa ... Read More

Use Word Function in Arduino

Yash Sanghvi
Updated on 30-Jul-2021 15:08:15

1K+ Views

The word() function converts a variable of any data type to the word data type. It is essentially a cast function.SyntaxThe syntax is −word(var)Where var is a variable of any datatype.Alternatively, you can also construct a word by specifying two bytes, the higher byte and the lower byte.SyntaxThe syntax is −word(highByte, lowByte)For instance, word(2,5) will return 517 (2 is 0b00000010 and 5 is 0b00000101; word(2,5) will return 0b0000001000000101, which equals 517).You can try out other combinations of characters and data types. You can read more about the word function from Arduino’s official documentation here.

What is a Word in Arduino

Yash Sanghvi
Updated on 30-Jul-2021 15:06:48

479 Views

A word, very simply put, is an unsigned number of 2 bytes (or 16 bits). Thus, it can take in values from 0 to 65535.Note that this definition is very microcontroller specific. In pure terms, a word is the amount of data a machine can process at a time, and it depends on the specifications of the machine.For example, instead of Arduino Uno, if you use the ESP32 board, the word becomes a 32-bit unsigned int instead of 16-bit. This is because ESP32 has different specifications compared to Arduino Uno. int sizes on ESP32 are also larger than Arduino.So, the ... Read More

Overview of Arduino IoT Cloud

Yash Sanghvi
Updated on 30-Jul-2021 15:02:01

694 Views

Arduino IoT Cloud is a service that tries to make it seamless to convert your Arduino devices into IoT devices.Any IoT device typically gathers data from sensors, does some processing onboard, and transmits either the raw or the processed data to a server. Arduino IoT Cloud allows you to generate a digital twin of your device (called as a thing), add variables and settings to that digital twin, and then generates the Arduino Sketch automatically which you can upload to the device. Thus, you essentially don’t need to write the Arduino Sketch yourself.What’s more, it also provides dashboards and widgets ... Read More

Connect Arduino to a WiFi Network

Yash Sanghvi
Updated on 30-Jul-2021 15:00:23

2K+ Views

In order to use WiFi with Arduino Uno, or any other board, you may need to get a WiFi shield(unless you are using a board with built-in WiFi capabilities, like Arduino Uno WiFi). The WiFi shield, like any other shield, stacks up on your board, and provides access to the pins of Arduino on the shield itself.You can read more about the WiFi shield here −www.arduino.cc/en/pmwiki.php?n=Main/ArduinoWiFiShieldhttps://www.arduino.cc/en/Guide/ArduinoWiFiShieldAssuming you have a WiFi shield with you, you will need the WiFi library to get started. You don’t need to download it separately; it will be built-in in your IDE. If you don’t get ... Read More

Difference Between Computer Architecture and Computer Organization

Ginni
Updated on 30-Jul-2021 14:56:30

4K+ Views

Computer ArchitectureThe architecture defines those attributes of the system apparent to the programmer or those attributes that directly force the program’s logical execution. It manage with the functional behavior of the computer system view by the user.Computer Architecture manages with the system’s programming part, including the multiple bits can define the several data types, input-output methods, approaches for addressing memory, and the computer’s instruction set. The implementation of any program is influenced by these qualities of architecture. The change in a bit or size can lead to a different result for the programmer.Computer OrganizationComputer organization can study the basic computer ... Read More

Scan Networks with Arduino WiFi

Yash Sanghvi
Updated on 30-Jul-2021 14:56:09

961 Views

In order to use WiFi with Arduino Uno, or any other board, you may need to get a WiFi shield(unless you are using a board with built-in WiFi capabilities, like Arduino Uno WiFi). The WiFi shield, like any other shield, stacks up on your board, and provides access to the pins of Arduino on the shield itself.You can read more about the WiFi shield here −www.arduino.cc/en/pmwiki.php?n=Main/ArduinoWiFiShieldhttps://www.arduino.cc/en/Guide/ArduinoWiFiShieldAssuming you have a WiFi shield with you, you will need the WiFi library to get started. You don’t need to download it separately; it will be built-in in your IDE. If you don’t get ... Read More

Advertisements