Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
How to create a Dialog in JavaFX?
A Dialog is a graphical element, a window that shows information to the window and receives a response. You can create a dialog by instantiating the javafx.scene.control.Dialog class.ExampleThe following Example demonstrates the creation of a Dialog.import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ButtonBar.ButtonData; import javafx.scene.control.ButtonType; import javafx.scene.control.Dialog; import javafx.scene.layout.HBox; import javafx.stage.Stage; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.FontPosture; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; public class DialogExample extends Application { @Override public void start(Stage stage) { //Creating a dialog Dialog dialog ...
Read MoreHow do I make the width of the title box span the entire plot in Matplotlib?
To make width of title box span the entire plot in matplotlib, we can take the following stepsSet the figure size and adjust the padding between and around the subplots.Create x and y data points using numpy.Plot x and y data points using plot() method, with color=black and linewidth=7.Get the current axes using gca() method.Set the title of of the plot.Return the bbox patch using get_bbox_patch() methodTo display the figure, use show() method.Exampleimport numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x = np.linspace(-2, 2, 100) y = np.sin(x) plt.plot(x, y, c='black', ...
Read MoreElectrical Components and Their Symbols
Wires and TracesComponent NameSymbolWires or ConductorTrace Junction or Connected WiresTrace Crossing or Unconnected WiresGroundsComponent NameSymbolGround or EarthSignal GroundChassis GroundSourcesComponent NameSymbolSingle CellBattery (Combination of cells)Photovoltaic Cell (Solar Cell)Independent or Constant Voltage SourceControlled or Dependent Voltage SourceIndependent or Constant Current SourceControlled or Dependent Current SourceAC voltage SourceResistorsComponent NameSymbolFixed ResistorRheostat (Variable Resistor)PotentiometerThermistor or VaristorCapacitorsComponent NameSymbolNon-polarized CapacitorPolarized CapacitorVariable CapacitorTrimmer CapacitorInductorsComponent NameSymbolAir Cored InductorIron Cored InductorTapped InductorTransformersComponent NameSymbolTransformerCenter Tapped TransformerStep up TransformerStep Down TransformerTransformer with two secondary windingsCurrent TransformerPotential TransformerZero Sequence Current Transformer (ZSCT)DiodesComponent NameSymbolPN Junction DiodeSchottky DiodeZener DiodeLight Emitting Diode (LED)Photo DiodeTunnel DiodeVaricap (Variable Capacitor Diode)Schockley DiodeConstant Current DiodeSilicon Controlled Rectifier (SCR)DiacTransistorsComponent NameSymbolN-channel, Junction ...
Read MoreInterfacing an ultrasonic sensor with Arduino
In this tutorial, we will interface the ultrasonic sensor HC-SR04 with the Arduino to get the distance from a surface in centimetres.Circuit DiagramAs you can see, you need to connect the Vcc pin of HC-SR04 to 5V, GND to GND, Trig pin to pin 7 of Arduino Uno, and Echo pin to pin 6 of Arduino. You can actually choose any GPIO instead of pins 7 and 6. You just have to make sure that the definitions in the code are proper.Working of HC-SR04The HC-SR04 emits ultrasonic waves at 40, 000 Hz. In order to make it emit waves, we ...
Read MoreRead a specific bit of a number with Arduino
Each number has a specific binary representation. For example, 8 can be represented as 0b1000, 15 can be represented as 0b1111, and so on. If you wish to read a specific bit of a number, Arduino has an inbuilt method for it.SyntaxbitRead(x, index)where, x is the number whose bits you are reading, index is the bit to read. 0 corresponds to least significant (right-most) bit, and so on.This function returns either 0 or 1 depending on the value of that bit in that number.ExampleThe following example will illustrate the use of this function −void setup() { // put your setup ...
Read MoreInterfacing a speaker with Arduino
In this tutorial, we will interface a simple piezo-buzzer with Arduino to create beeping sounds. Such an arrangement can be used in applications like burglar alarms, or water level indicators or such similar projects.Circuit DiagramAs you can see, the circuit diagram is quite straightforward. You need to connect the buzzer’s GND to Arduino’s GND, and the other wire to one GPIO of the Arduino (we have chosen pin 7). You can optionally add a small resistor (~100 Ohm), between the GPIO and the buzzer.Code WalkthroughThe entire code is given below −#define buzzerPin 7 ...
Read MoreGetting data from temperature and humidity sensor using Arduino
In this tutorial, we will interface Arduino DHT-22 Temperature and Humidity Sensor and print the obtained temperature and humidity values on the Serial Monitor.Circuit DiagramWhen the DHT-22 is facing you, the first pin from the left, the VCC pin is connected to 5V, the next pin is the DATA pin, and it is connected to pin 2 on Arduino Uno. The third pin is Not Connected. The 4th pin, GND, is connected to GND on Arduino. A 10K resistor is to be connected between the DATA pin and the Vcc pin of DHT22, as you can see in the above ...
Read MoreGetting data from Vibration sensor using Arduino
In this tutorial, we will interface Arduino with the MPU6050 Vibration sensor.Circuit DiagramAs you can see, we connect Vcc to 3.3V, GND to GND, SDA to A4 and SCL to A5. A4 and A5 also serve as SDA and SCL on Arduino Uno.Code WalkthroughThe code is given below −#include const int MPU_ADDR = 0x68; // I2C address of the MPU-6050 int16_t AcX, AcY, AcZ, Tmp, GyX, GyY, GyZ; void setup() { Serial.begin(9600); Wire.begin(); Wire.beginTransmission(MPU_ADDR); Wire.write(0x6B); // PWR_MGMT_1 register Wire.write(0); // set to zero (wakes up the MPU-6050) Wire.endTransmission(true); Serial.println("Setup complete"); } ...
Read MoreDisplaying data on OLED Screen using Arduino
In this tutorial, we will interface Arduino with the SSD 1306 OLED Display.Circuit DiagramAs you can see, we connect Vcc to 3.3V, GND to GND, SDA to A4 and SCL to A5. A4 and A5 also serve as SDA and SCL on Arduino Uno.Required LibrariesThe following libraries will be required for interfacing Arduino Uno with the OLED Display −Adafruit SSD1306Adafruit GFXAdafruit BusIO (required by Adafruit GFX)Go to Tools → Manage Libraries, search for these libraries and click Install.ExampleThe code is given below −#include #include #include #define WIDTH 128 // OLED width (pixels) #define HEIGHT 64 // ...
Read MoreInterfacing GNSS receiver with Arduino to get speed
In this tutorial, we will interface Arduino with a GNSS Receiver and obtain the speed. If possible, you can run this code in a moving vehicle, because otherwise you will get 0 speed if your GNSS receiver is stationary. Any GNSS receiver generally uses UART for communication. We will be using the ublox Neo-6M GNSS module for thisCircuit DiagramAs you can see, we connect Vcc to 5V, GND to GND, RX of the Neo 6M to pin 3 of Arduino Uno, and TX of Neo 6M to pin 4 of Arduino Uno.Required LibrariesTinyGPS library will be required for interfacing Arduino ...
Read More