Posted on Leave a comment

iPhone 15 could be the first iPhone to feature Wi-Fi 6E

AppleInsider may earn an affiliate commission on purchases made through links on our site.

A new analyst note suggests that Apple will be bringing Wi-Fi 6E to the iPhone 15, bringing the device in line with other Apple devices like the Mac mini, MacBook Pro, and iPad Pro.

Barclays analysts Blayne Curtis and Tom O’Malley shared a research note, seen by MacRumors, that posits Apple will add Wi-Fi 6E support to its upcoming iPhone 15 lineup.

Currently, it’s yet to be determined whether support will be limited to the iPhone 15 Pro models.

Wi-Fi 6E works on the same 2.4GHz and 5GHz bands that Wi-Fi 6 does but also works over the 6GHz band. This enables faster wireless speeds and less signal interference. To use the 6Ghz band, devices must be connected to a Wi-Fi 6E router.

The iPhone 14 lineup features standard Wi-Fi 6, despite previous rumors suggesting that it would see an upgrade.

The iPhone 15 is anticipated to release at the 2023 fall Apple Event, and analysts have already begun making predictions for Apple’s next generation of smartphones.

Some believe the iPhone 15 and iPhone 15 Plus will feature a 3-stacked sensor and 48-megapixel wide lens, the same as the iPhone 14 Pro models.

Regarding the higher-end iPhone 15 Pro and iPhone 15 Pro Max, some analysts expect that Apple will add a 12-megapixel periscope lens geared toward improved optical zoom.

Both the iPhone 15 Pro and iPhone 15 Pro Max are anticipated to have an A17 chip built with TSMC’s 3-nanometer technology, 8 gigabytes of RAM, and a new titanium frame.

Posted on Leave a comment

Apple gearing up to re-release revamped HomeKit architecture

Apple’s December HomeKit architecture rollout

New unearthed code suggests that Apple will soon re-release its Homekit architecture after it initially withdrew the option in December.

For the previous attempt, users reported seeing devices stuck in an “updating” mode after the upgrade completed, with some devices unresponsive or failing to update fully. At the time, it was unclear what had caused the problems as there weren’t any commonalities between accounts of the issue.

Posted on Leave a comment

Apple still on track for iPad Pro revamp with OLED display in 2024

The 2022 12.9-inch iPad Pro on the Magic Keyboard

Apple may be planning a “major iPad Pro revamp,” which could include a new OLED display — but it likely won’t occur until 2024.

In Sunday’s edition of Power On, Mark Gurman suggests that 2023 will be a relatively uneventful year for iPad. As a result, if his report is accurate, there will be no significant upgrades to the iPad Pro, iPad Air, iPad mini, or entry-level iPad.

However, Gurman believes that Apple may be planning a notable revamp for the iPad Pro that could happen in early 2024. He suspects the tablet will get an “updated design,” and reiterates rumors that have been circulating for about 18 months about incorporation of an OLED display.

Some rumors claimed that the iPad Pro lineup would get microLED display technology by 2024, a report now suggests that the technology will first come to the Apple Watch Ultra in 2024. The rest of Apple’s devices, including its iPhone, iPad, and Mac lineup, could get microLED starting in 2025.

Posted on Leave a comment

Apple’s slower hiring allows it to avoid wave of big tech layoffs

Apple has, so far, avoided announcing mass layoffs.

AppleInsider may earn an affiliate commission on purchases made through links on our site.

Apple has managed to avoid joining the wave of mass layoffs at other tech giants, with its slower rate of hiring allowing it to avoid issues that Alphabet, Microsoft, Meta, and Amazon have run into with high employee headcounts.

Following Meta’s 11,000 job cut warning in November, the layoffs at tech giants has seen thousands go out of work. Microsoft is axing 10,000 employees, Google’s doing the same for 12,000 employees, and Amazon’s set to lay off 18,000.

In a profile in the Wall Street Journal, it is proposed that Apple has yet to join the rest of the group with a major layoffs round, due to a combination of a resilient business and a slower rate of hiring.

From September 2019 to September 2022, Apple’s headcount grew 20% to 164,000 full-time employees. By comparison, rivals turned up the heat on hiring, with Microsoft swelling by 53%, Alphabet by 57%, and Meta by 94% during the same general period.

Apple isn’t immune to the market, with its December quarter thought to be rougher than usual due to manufacturing issues in China. Meanwhile, in its retail channels outside of Apple Stores, such as at Best Buy locations, non-seasonal employees are being given a thirty-day notice about their rights relating to a layoff.

As for its more direct workforce, there is still an expectation that Apple will try to reduce its headcount. According to senior research analyst Tom Forte of D.A. Davidson & Co, reductions could be made simply through employee attrition, namely not replacing workers who decide to leave.

There is also the possibility that Apple could make cuts or changes to employee perks. It already doesn’t provide free lunches to employees located on its corporate campus, something offered by Google and Meta to their workforces, but other benefit areas could face cost-reductions.

The last time Apple performed a mass layoff was in 1997, at the time of co-founder Steve Jobs’ return to the organization. At that time, approximately 4,100 employees were axed to cut costs.

Posted on Leave a comment

Fuel 4-in-1 Power Station review: Small footprint, big capabilities

Fuel 4-in-1 Power Station

AppleInsider may earn an affiliate commission on purchases made through links on our site.

The Fuel 4-in-1 Power Station from Case-Mate can simultaneously recharge an iPhone, Apple Watch, AirPods, and a fourth device in an all-in-one charging system.

Made with recycled materials, the power station has wireless power options for three Apple devices, and it also includes a USB-C port to charge an additional device. It works with Qi-compatible products at up to 15W of power.

Fuel 4-in-1 Power Station – Specifications

The iPhone stand has a max output of 15W, though iPhones are limited to 7.5W under Qi without MagSafe, while the AirPods and Apple Watch pads produce 10W and 5W, respectively. The USB-C PD 3.0 port has a maximum output of 20W.

The power station doesn't have a large footprint, so it should be able to fit on most desks and side tables

The power station doesn’t have a large footprint, so it should be able to fit on most desks and side tables

There are charging indicators on the power station that light up when a device is charging, with an amber color used when it detects metal objects such as keys or coins. Fuel recommends removing the object and aligning the iPhone on the charger to ensure regular operation.

Fuel 4-in-1 Power Station – Usage

The power station doesn’t have a large footprint, so it should be able to fit on most desks and side tables. It measures just under eight inches in length, 3.5 inches in width, and just under 0.5 inches for height.

The charging slot for the iPhone is purely Qi and doesn’t have any magnets for MagSafe iPhones — it just leans there. Like most 15W chargers, it can recharge an iPhone 14 from 0% to 100% in about two hours.

For charging other devices, AirPods Pro reached 100% in roughly two and a half hours, and 3.5 hours for an Apple Watch Series 7. The USB-C port offers more power and cuts the Apple Watch charging time down to about two hours using Apple’s USB-C fast charging cable.

It comes with a DC power brick

It comes with a DC power brick

A DC cable with a barrel connector powers the Fuel 4-in-1, which isn’t ideal since it has limited usage. We can’t think of any other product like this one, with that type of input port. In an age of high-power USB-C, this isn’t fabulous.

That said, it’s a nice power station, overall, and a good competitor for similar products at its price point. For example, a cursory web search surfaced other 4-in-1 chargers.

We found some that were around $100, and others as high as $180, and they were from well-known brands. Case-Mate is such a brand, and the Fuel power station is a fine addition to their collection.

Adding magnets to the iPhone and AirPods charging components would have been nice, because a wayward pet or child could easily knock devices loose. This reviewer’s house has neither of those, however, so that particular situation wasn’t available for testing.

Fuel 4-in-1 Power Station – Pros

  • Nice design
  • Every charging pad is fully powered for Apple devices
  • Foreign object detection

Fuel 4-in-1 Power Station – Cons

  • DC connector with barrel connector, versus USB-C
  • MagSafe-like magnets would be nice

Rating: 4 out of 5

Pricing & Availability

The Fuel 4-in-1 Power Station is available from Case-Mate for $150.

Posted on Leave a comment

How to cancel a subscription to Tweetbot or other Twitter clients

Twitter clients

AppleInsider may earn an affiliate commission on purchases made through links on our site.

Twitter has cut off nearly every Twitter client, and most of them are subscription-based apps. The developers are working on dealing with it, but that’s going to take time. Here’s how to cancel a subscription to Tweetbot or other Twitter clients.

The problem started on January 13, when popular Twitter clients such as Tweetbot, Twitterific, and Echofon stopped working. However, others did not.

As a result, users could not log into their accounts or view their timelines. At first, developers thought it was a bug, but Twitter later revealed that it was intentional and updated its developer’s agreement with a clause prohibiting app developers from making their own Twitter clients.

How to cancel a subscription to an app

Tapbots, the creator of apps such as Tweebot, is working with Apple to cancel any subscription renewals automatically, and developers of other apps may be doing the same. However, users can manually cancel their subscriptions now, and not wait for the process to lurch to a conclusion.

  1. Open Settings on an iPhone or iPad.
  2. Tap your Apple ID.
  3. Next, select Subscriptions. This presents a list of active and expired app subscriptions.
  4. Find the subscription for your Twitter client app, tap on it, and hit the Cancel Subscription button.

A popup will appear asking to confirm the cancellation and noting that users can still access the subscription until the renewal due date. Tap on the Confirm button to proceed.

Canceling a subscription

Canceling a subscription

There is a call on social media for folks to ask Apple for a refund instead. This is within users’ rights, of course, but the fault is more on Twitter, and not on the developers.

We here at AppleInsider are cancelling our subscriptions because there’s no telling how long the process is going to take.

As far as we are concerned, the developers are entitled to the few dollars that they might get for the last week of confusion, since they had nothing to do with the cut-off.

Posted on Leave a comment

Apple TV+ content currently unavailable due to outage

AppleInsider may earn an affiliate commission on purchases made through links on our site.

Apple’s subscription streaming service, Apple TV+, has been experiencing a widespread outage on Thursday evening.

The outage affects the service for all Apple devices, including the Mac. Apple has acknowledged an intermittent outage affecting both Apple TV Channels and Apple TV+ on its system status page.

Users on Twitter have also reported the outage.

AppleInsider staff have been able to reproduce this error, noting the iOS app often only displays the option to view a user’s existing library. If users can access the Apple TV+ tab, it shows a “content unavailable” message.

Posted on Leave a comment

Apple announces premiere dates for more Apple TV+ shows

Image Credit: Apple

AppleInsider may earn an affiliate commission on purchases made through links on our site.

Apple has announced premiere dates for additional Apple TV+ offerings available this spring, including the return of “The Afterparty” and “Schmigadoon!”

Apple TV+ spring lineup continues as “Schmigadoon!,” “City on Fire,” “The Last Thing He Told Me,” “Extrapolations,” and “The Afterparty” get premiere dates.

“Schmigadoon!”

Apple’s acclaimed, award-winning musical comedy returns to Apple TV+ on Friday, April 7. New episodes will premiere every Friday through May 5, 2023.

“Schmigadoon!” follows Josh (Keegan-Michael Key) and Melissa (Cecily Strong) in Schmicago, the reimagined world of ’60s and ’70s musicals.

The series has won both Emmy and AFI awards, as well as a Critics Choice Award nomination.

“City On Fire”

The series follows the story of Samatha, an NYU student is shot in Central Park on the Fourth of July, 2003. There are no witnesses and very little physical evidence.

Image Credit: Apple

Image Credit: Apple

As the crime is investigated, Samantha is discovered to be the connection between a series of citywide fires, the music scene, and a wealthy uptown real estate family.

Samantha will be played by Chase Sui Wonders, known for her role as Riley in “Generations.” Wyatt Oleff (“It,” “It Chapter Two”) plays Charlie, a friend of Samantha’s who stops at nothing to unravel the mystery of what happened.

“City On Fire” is set to premiere on Apple TV+ on Friday, May 12.

“The Last Thing He Told Me”

Executive produced by Jennifer Garner, “The Last Thing He Told Me” follows Hannah (Jennifer Garner), who must forge a relationship with her 16-year-old stepdaughter Bailey (Angourie Rice) to find out why her husband has mysteriously disappeared.

Image Credit: Apple

Image Credit: Apple

“The Last Thing He Told Me” will premiere on April 14 on Apple TV+.

Set to premiere on March 17, “Extrapolations” is a drama set in the near future, where climate change has affected our everyday lives.

Image Credit: Apple

Image Credit: Apple

Eight stories about love, work, faith, and family will explore the choices that must be made when the planet changes faster than the population.

“The Afterparty”

Apple has announced that its murder mystery comedy series “The After Party” will return to Apple TV+ on Friday, April 28.

Image Credit: Apple

Image Credit: Apple

In the second season, a wedding is ruined when the groom is murdered and every guest is a suspect.

“The Afterparty” explores each character’s account of a fateful evening, with each story told through the lens of a popular film genre.

Posted on Leave a comment

Apple agrees to audit labor practices ahead of shareholders meeting

Apple Park

AppleInsider may earn an affiliate commission on purchases made through links on our site.

In an effort to appease investors, Apple will undergo a third-party assessment of its labor practices concerning workers’ freedom and collective bargaining.

The news of the audit comes ahead of the 2023 annual shareholder’s meeting on March 10.

According to a filing with the SEC spotted by The New York Times, Apple has said the assessment will focus on whether Apple is upholding its official human rights policy as it relates to “workers’ freedom of association and collective bargaining rights in the United States.”

As part of the agreement, Apple will hire a third-party firm to conduct the assessment.

Apple has been accused of undergoing anti-union tactics as employees at Apple stores push unionization efforts.

The National Labor Relations Board has evidence that Apple used anti-union tactics to try to stop unionization efforts, including interrogating and coercing employees.

In December, the Cupertino tech giant was accused of illegally creating a workgroup driven by managers to try to stop union organizing efforts.

In November, Apple Towson filed a labor complaint against the company for unfairly withholding health and education benefits from members.

Posted on Leave a comment

How to get started coding for Arduino on macOS Ventura

AppleInsider may earn an affiliate commission on purchases made through links on our site.

In a previous article, we looked at connecting various kinds of Arduino hardware to your Mac. Here’s how to get started programming on them to create your own projects.

Getting started

In order to program your Arduino, you need the Arduino IDE (Integrated Development Environment) from the arduino.cc website. We mentioned how to download and install the IDE in the previous article but we’ll reiterate it here:

On your Mac, go to arduino.cc, click on “Software”, then under the Download Options section, click the link for the Mac version for either Intel or Apple Silicon.

Note that unless you want to explore the current development version, you don’t want the link under the section “Nightly Builds”. Nightly builds may be unstable and contain bugs.

Once you’ve downloaded the IDE, refer to the previous article for details about how to connect and set up your Arduino on your Mac in the IDE. You need a connection before you can upload code from the IDE to your Arduino.

Basics

You only need rudimentary programming skills to program your Arduino. You can use Arduino’s C-like programming language, or Python, but we’ll only use C in the examples below.

In Arduino programs, called Sketches, you essentially write code to set up your Arduino for a specific tasks or tasks, then run a continuous loop which gets called repeatedly by the Arduino microcontroller once your Sketch is uploaded to your Arduino device. The loop usually waits for input from sensors or users, and sends control signals back to sensors and devices to display some sort of output.

The loop code can also connect to, and interact with, the internet.

You can also install third-party libraries which support various sensor devices and shields using the Library Manager in the IDE. To access the Library Manager, create or open a sketch window, and click the icon on the left side which looks like a set of books:

A pane will appear and at the top, you can browse available libraries by Type and Topic by clicking either of the two popup menus:

You can also check for installed library updates by selecting “Updatable” from the “Type:” menu.

The Library Manager pane lets you download official and third-party libraries. Libraries are code bundles that add a specific functionality or device support to the IDE.

For example, if you use a particular brand of a non-generic sensor, you’ll need to download its library and install it first.

You can view different categories of libraries by clicking the “Topic” popup menu at the top of the Library Manager window.

Most Arduino Sketches are simple and short and are stored in a “Sketchbook” folder specified in the Arduino IDE Settings window. You can change where the IDE stores sketches from here by clicking the Browse button next to “Sketchbook location”:

Sketches have a file extension of .ino, which stands for “innovation”.

You can also change text editor and compiler settings here. If you have an unsupported Arduino, you can add its board support file or URL by clicking the small icon in the lower right of the window, one which looks like a stack of documents.

Click on the “Click for a list of unofficial board support URLs” text in the Additional Boards Manager URLs window to view the vast array of boards supported on Arduino’s GitHub.

The Arduino IDE provides a sample sketch with a simple program outline in a text window when you first open it.

There are also a vast array of code samples under the File->Examples submenu item. Samples are organized by “Built-In” and “UNO Examples” in the menu. Custom-installed libraries may also provide examples.

A first example sketch

In our first example, we’ll use the built-in Blink example. To open it, select File->Examples->0.1Basics->Blink submenu item.

After a few seconds, a new editor window will open with the Blink example. Make sure your Arduino board and port are selected from the connection popup menu at the top of the IDE’s editor window.

Blink does one thing — it blinks a built-in LED on the Arduino. There’s a description of the sample in the comment at the top of the editor window and online.

In code, comments are notes programmers leave to describe what code is doing. Comments are ignored during compilation.

The IDE editor window uses C-style comments: the compiler will ignore anything bracketed inside of /* and */. Single-line comments start with // but must be on one line only. Anything after the // is ignored.

When you click the large Verify button with the checkmark icon in the editor’s upper left corner, the IDE will compile the code in that window.

During compilation, an Output pane will appear at the bottom of the editor window in black showing progress. If there are no errors, you’ll see messages such as:

"Sketch uses 924 bytes (2%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes."

Or something similar.

If there are errors, they will appear in red text and you’ll have to fix your code until there are no more errors. Some errors are not critical, and your sketch will still run with them, but other errors can prevent your sketch from running at all.

You can clear the Output messages by clicking the small icon in the upper right corner of the Output pane. You can hide the Output pane entirely by clicking the small square icon in the lower right corner of the editor window.

When you click the Upload button (the one with a large right arrow icon) next to the Verify button, the IDE uploads the compiled binary program into the Arduino on the port you specified. The Arduino microcontroller takes over from there and executes your code on the Arduino.

During upload, if your Arduino has an RX (Receive) LED built-in, you should see it flash rapidly as it receives the sketch data.

If your Sketch couldn’t be uploaded for any reason, the Output pane will list a description and why.

A few words about C-based languages

C is the language of operating systems. Some early Mac apps in the late 1980s and the 1990s were written in C or one of its later variants: C++.

The Arduino IDE programming language is based on C-like syntax.

In most C-like languages, all code lines end with a “;” — without the semicolon, the code won’t compile and you’ll get an error.

Most C-based languages also use predefined code text files called headers, which usually have a “.h” file extension.

Think of a .h file as a predefined set of code that describes how functions are to be accessed, called prototypes. Each prototype defines a function name, parameters to be passed to the function (inside parenthesis), and a return type that is sent back from the function when it exits.

If you call (access) any library or built-in functions in your Sketch code, how you call each function must match its prototype defined in a .h file somewhere. Libraries work the same way.

For example, if a prototype says a function must take two input parameters (in the parenthesis), and a certain type of return value (listed before the function name), then you must call it in precisely the same way. Anything else will throw an error during compilation.

Header files can also contain a C-style construct called a ‘define.’ A define creates a label as another code expression, such as a number, text (a string in C), a calculation, or some other function.

To create a define, you use the #define C preprocessor directive. For example:

#define FALLING 2

This code defines the label ‘FALLING’ as the value of 2. Anywhere you use FALLING in your code, the number 2 will be substituted at compile time. #defines can get quite complex but can make your code shorter and more readable.

The Arduino IDE uses #defines to define things like I/O pin numbers, modes, and other things.

You can also create your own headers and #defines.

Headers can be included in other files – in other .h files, or in Sketches themselves. The contents each included .h file get inserted at compile time into the top of any files they are included in.

To insert a header into another file, use the #include C directive. For example at the top of Arduino.h you’ll see:

#include "binary.h"

Which includes another header file called “binary.h” into the top of Arduino.h at compile time.

If you look at the screenshot shown above you’ll see two included .h files in the example Sketch:

EEPROM.h
Ethernet.h

All this may seem confusing at first, but it’s actually quite simple: you put function prototypes and #defines in .h files so they can be used in many other files. Then you #include them in other files and the compiler inserts them where indicated during compilation. Easy.

Organizing definitions into seperate headers enables code reuse.

Just think of .h files as definitions, and your Sketch files as programs that use them.

Modern programming languages such as Apple’s Swift and Microsoft’s C# have done away with header files, in the interest of simplicity.

In the Blink sample’s setup() function, there is one line of code:

pinMode(LED_BUILTIN, OUTPUT);

Both LED_BUILTIN and OUTPUT are #defines defined by Arduino headers. The main Arduino header file is named Arduino.h, as we saw above.

You can hold down the Command key on your Mac keyboard and double-click any #define in an editor window to jump to its definition in the corresponding .h file where it’s defined. A new tab will open in the same editor window displaying the matching .h file.

LED_BUILTIN is defined as “13” in pins_arduino.h:

#define LED_BUILTIN 13

This indicates digital pin 13 on the Arduino’s pins connector (also called a header).

But at the same time LED_BUILTIN tells the Arduino to use the actual built-in LED on the Arduino circuit board itself. If you connect a jumper wire to pin D13 on the Arduino header, then connect it to an LED on a breadboard, it will blink that LED also.

pinMode’ is a built-in Arduino function that sets how a given I/O pin on the Arduino behaves – either input or output. In this case, we’re telling the Arduino to use pin LED_BUILTIN (13) as an output pin.

Since pinMode()’s prototype in the wiring_digital.h header has a return type of ‘void’, the function doesn’t return any value. ‘void’ is a C data type meaning ‘nothing’. All C functions having a ‘void’ return type return nothing.

When the compiled Blink sketch runs on your Arduino, it runs setup() first, setting up the hardware, then it runs loop() over and over forever. In the Blink example, loop() simply turns the pin on and off with a delay of one second between each:

digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000);
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000);

“High” and “Low in electrical engineering terms simply mean “on” and “off”.

digitalWrite() is a built-in Arduino function that simply turns the digital U/O pin specified on or off – in this case whatever is attached Arduino pin D13, or LED_BUILTIN.

delay() is a delay function that halts further processing until the specified interval has elapsed. delay() takes a single time value, in milliseconds, with a value of ‘1000’ being one second.

Go ahead and click the Upload button in the Blink Sketch IDE window.

That’s it. You’ve now compiled and run your first sketch. If everything worked, you will see the built-in LED on your Arduino blink on and off.

Most shields also have a built-in LED on them which does the same thing as the built-in one on the Arduino.

A breadboard example

Now that you’ve seen the Blink example in action, we’ll do the same thing – but this time we’ll make an external LED on a breadboard blink at the same time. For this example you’ll need:

  1. A breadboard
  2. 2 jumper wires
  3. 1 3.3V LED
  4. 1 220 Ohm resistor

First, plug two jumper wires into the “D13” or “13” and “GND” holes on the corresponding Arduino headers.

Plug the other end of the “D13” wire anywhere into row one in the interior of the breadboard (any position except in the “+” and “-” power rails on the outer edges).

Next, install the LED onto the breadboard so the long (+) leg of the LED is in the same horizontal row as the “D13” wire you just installed.

Turn the LED sideways so the short leg is inserted into a hole towards the long end of the breadboard about three holes away.

Next, insert a 220 Ohm resistor into the same horizontal row as the short LED’s leg, but towards the power rail on the opposite side of the board. Across the center of the board works perfectly.

Insert the other end of the resistor into another hole in the same direction about three holes away.

You should now have the “D13” wire, LED, and resistor in a pattern somewhat in the shape of a stretched-out “Z” (see photo below).

At the other side of the breadboard in the last or second to last hole before the power rail, insert the other end of the “GND” jumper wire. The final assembly should look something like this:

Remember there is a grid of metal rails under all the holes on the breadboard. No matter which way components are oriented on the breadboard, they must always form connections between components, the Arduino, and with jumper wires to complete the circuit.

If you already uploaded the Blink example to your Arduino, you should see the LED start to blink. Both the LED on the Ardunio and the one on the breadboard should blink in unison. If not, go back and check all your connections again.

Note that some electronic components such as LEDs are polar: current can only flow through them correctly in one direction. Other components such as most resistors are non-polar: current can flow the same through them in either direction.

You can play around with the timing value passed to the delay() function to speed up or slow down the blink rate of the LEDs. Try huge and tiny values and watch what happens.

By adding more digitalWrite() and delay() statements to your Sketch you can alter the blink pattern: for example, you can make the LEDs blink Morse Code.

Final example: a traffic light simulator

Now that you’ve seen how to blink your Arduino’s LED, we’ll use one final, slightly more complex example: we’ll use a third-party UNO breakout board and an external traffic light sensor board to simulate a three-color traffic stop light.

Alternately, you can find a temporized one with a countdown timer LCD also on PCBWay.

In our example, we’ll use the simplest three-light sensor and make it change colors at brief intervals, just like a real traffic light.

These traffic light boards usually have three or four pins: one for each colored LED, and one GND. The code is smilier to Blink, except that you turn all the lights off except one, wait using delay(), then turn that one off, and the next one on, in sequence.

First, we’ll connect our traffic light sensor to a generic breakout shield we have installed on our Arduino UNO: breakout shields are shields containing banks of analog and digital pins, GND pins, Bluetooth, and serial cable connectors.

Our traffic light sensor has four pins: R, G, Y, and GND. We’ll connect digital pins 9, 10, and 11 to R, G, and Y respectively, and the fourth pin, GND to a GND pin on our shield.

Now open the Arduino IDE and start a new Sketch. First, we’ll define some things we’ll need at the top of the Sketch above setup().

First, we define how many milliseconds are in a second so we can specify how many seconds to pass to delay();

#define kMillisecondsInSec 1000

Next, we define how many seconds we want the yellow light to be on for:

#define kSecondsForYellow ( kMillisecondsInSec * 4 )

Then we define which three pins we want to use for red, yellow, and green on the Arduino. Instead of using defines, we assign the pin values each to a global variable, in this case variables of type int (which is defined by C):

int RED = 9;
int YELLOW = 10;
int GREEN = 11;

Think of a variable as a named container whose contents (value) you can change whenever you want. Variables also have a type in order to specify what kind of values they can hold. Global variables can be accessed from anywhere in a program.

Variables declared inside of functions are called local variables and can only be used inside one function. This is called variable scope.

Next, we define global variables and assign calculations to them to simplify how we calculate seconds and milliseconds, and delay values for the green, red, and yellow lights in seconds. In this case we use a variable type called ‘unsigned long int’, which are like ints, but can hold larger values:

unsigned long int millisecondsInMinute = ( kMillisecondsInSec * 12 ); // # of milliseconds in 1 min.
unsigned long int minutesForGreenAndRed = ( 1 * millisecondsInMinute ); // number of minutes to leave green, red lights on.
unsigned long int yellowDelay = kSecondsForYellow; // Time to leave yellow light on. Yellow delay is shorter than red/green.

Now in setup() we define the pin modes for pins we defined above, one each for red, yellow, and green:

void setup( void )
{
pinMode( RED, OUTPUT );
pinMode( YELLOW, OUTPUT );
pinMode( GREEN, OUTPUT );
}

This tells the Arduino we will use those three pins for output values (in this case on or off).

In loop(), we start by turning the red/yellow lights off, the green light on, then we wait for onDelay seconds:

void loop( void )
{
// Green - Start
digitalWrite( RED, LOW );
digitalWrite( YELLOW, LOW );
digitalWrite( GREEN, HIGH );
delay( onDelay );

After onDelay, we turn the green light off, the yellow light on, then wait for yellowDelay seconds:

digitalWrite( GREEN, LOW );
digitalWrite( YELLOW, HIGH );
delay( yellowDelay );

After yellowDelay, we turn the yellow light off, the red light on, and wait for onDelay seconds:

// Red
digitalWrite( YELLOW, LOW );
digitalWrite( RED, HIGH );
delay( onDelay );

Finally, after onDelay elapses, we turn the red light off, effectively resetting the simulation:

digitalWrite( RED, LOW );
}

The next time the loop runs, the same sequence repeats, starting with the green light. This loop will run forever until stopped. We now have a working traffic light simulator:

Once you’ve uploaded the Sketch to your Arduino, if you plug in an external power supply to your Arduino’s DC barrel jack, and unplug its USB cable, the simulation will continue to run.

This is one of the benefits of Arduino: once you program the microcontroller, it can run a program independently of a host computer.

You can make Arduinos do just about anything – act as sensors, display info, wait for input, make sounds, use cameras and send images back to other devices, monitor conditions, drive motors, and so on.

I’ve posted the complete traffic light Sketch. You can download it and upload it to your Arduino.

There are a few introductory books worth reading for learning Arduino’s C-like language:

These simple examples should get you started programming Arduino. As you build your programming skills and gain confidence, you can expand to bigger examples.

In future articles, we’ll explore programming Arduino devices, shields, and busses such as I2C and SPI, and creating complex device environments.