Rescue off-screen windows easily (Windows.10 and Linux.Mint)

When a program is moved off the main screen – maybe to a second monitor which is now no longer connected – you need a quick and easy way to move it to the current monitor. This is what I do –

There are several programs running on the extended desktop (on the right hand side monitor).

Without the second monitor all you see is this, and your programs are trapped out of sight.

Running programs are not visible

To see what’s hidden off-screen, hold down ALT and press TAB repeatedly. This cycles through thumbnail images of all windows even if they are off-screen or minimized. Release both keys when you highlight the window you want to rescue.

There are 5 off-screen windows to choose from

When both keys are released, the window is selected but not visible. Hold the WINDOWS (flag) key down and press the LEFT arrow key a few times until the window is visible. Release both keys.

First window is rescued.

When you release the keys, the recovered window will stay where it is, and other windows will be offered for rescue.

On the left are other available windows.

Mouse click on the second window you want to rescue and it will be placed next to the first.

Two windows have now been rescued

Repeat the actions for other off-screen windows, and you’re done.

Note that you can use the WINDOWS key with the arrow keys (up, down, left, right) to park windows to any part of the screen.

Sometimes the off-screen program may be waiting for a user response, so try pressing ESCAPE or ENTER to dismiss it. If all esle fails close the program using Task Manager, then reopen it normally. If it starts off-screen, it should now recover easily.

Compiling and uploading Arduino sketches from within Notepad++

Notepad++ is my favourite editor for Arduino sketches, but it lacks the facility to compile and upload sketches directly to the Arduino boards. The usual procedure would be to save the sketch in Notepad++, switch to the Arduino IDE then compile/upload.

However, there is a plug-in for Notepad++ which enables you to run external commands – this post describes how to set it up for the Arduino IDE.

Install the plugin

First ensure you have the latest version of Notepad++ (currently version 7.6.3) and select the menu item under ‘Plugins Admin…’.

Then select the ‘NppExec’ plugin and click install.

Set up the commands to execute

After it installs, you’ll be able to select ‘Execute…’ from the new sub-menu (or simply press ‘f6’), which will display the ‘Execute…’ dialog box.

The empty ‘Execute…’ dialog box will display.

Enter the following text into the command(s) window, ensuring the path points to your ‘arduino_debug.exe’.

set arduino_path = “C:\Program Files (x86)\Arduino\arduino_debug”
npp_save
inputbox “Enter the COM port of your Arduino (e.g., COM1):”
cmd /c $(arduino_path) –port $(input) –upload $(full_current_path)

Commands are remembered in the Execute window

Pressing ‘OK’ will allow you to enter the COM port (this is shown in the Arduino IDE ‘Tools’ menu).

The COM port number is remembered too.

Press ‘OK’ and the process of compiliation and uploading will begin.

A pane opens in Notepad++ and displays the Arduino compilaition progress

SUMMARY OF HOW TO USE IT

  • Open the Arduino code in Notepad++
  • Edit your code
  • Press f6
  • Press ‘Enter’ twice
  • Watch the results window.

TIPS (for the Arduino IDE)

  • Keep the Arduino IDE open with your sketch.
  • In Arduino IDE select external editor (File -> Preferences -> Settings Use External editor
  • Ensure the serial port monitor is not open.

A wi-fi and touch controlled NeoPixel ring using the Wemos D1 Mini ESP8266 module.

This project describes an easy way to control a strip or ring of WS2812 LEDs via a web page. It was originally based on the Arduino FastLED library.

Although the FastLed library code gives us a great example of how to control NeoPixel rings and strips, it doesn’t provide for user interaction. So it was decided to add the ability to control the device by wi-fi, and also have a touch switch for local control.

Materials required
A Wemos D1 Mini module was used as it consisted of a low-cost ESP8266 wifi chip and antenna, and it can be programmed by the familiar Arduino software. The Wemos module sits in a socket which is soldered to a matrix circuit board. This allows the module to be swapped out if needed, and also makes it easier to connect the touch-switch and neopixel wires.

A touch switch module was chosen rather than a discrete push-switch as it can be hidden behind the acrylic case and should also provide more reliable switching. The 100 x100 x 25mm square case was laser cut from 3mm acrylic, and was designed using the makercase on-line designer. This is the quickest software for making simple boxes. An extra 100mm square piece was cut for the front, with two circular cuts to accommodate the neopixel ring so it can lie flush with the front surface. Later, the touch-switch hole was cut so the sensor sits behind only one thickness of acrylic.

Laser cut acrylic case

The components fitted easily inside the box – it has plenty of room for a battery pack if you wanted to make it totally portable.

The touch switch sits in a rectangular cut-out.
Here is a view before the centre cover is glued on.

Software overview. The project uses websockets so that any web browsers connected can control (and be controlled) by the device. The touch-switch also controls the software and the settings are communicated to all connected browsers via websockets in real time.

User settings are stored in an object, derived from the ‘userDataClass’. This object stores settings for the brightness, colour, active pattern, demo pattern, provides functions for brightness gamma correction, etc.

The touch-switch code decides whether the switch received a tap or long press. A tap changes the pattern and a long press increases/decreases the brightness. Debouncing the switch was achieved by using a 32 bit integer and bit-shifting each switch reading into it. This method has both the advantage of being able to check for a steady switch state, and to discriminate between a short or long press. A future article will explain exactly how this is done.

Here’s a video of it working.

How to download a complete website, including links between pages.

Quite often, you may download sections of a website, only to find downloading separate pages does not maintain the links between them.

There is an easy way to grab whole sections of a site (or even a whole site), such that you can run it locally offline with all the links between pages intact, and you can even upload the whole captured sections to your own website and the relative links will still work!

Copy and paste the index page or a sub page into httrack

It works on Windows 2000 to Win10, and Linux. You can use the portable version which will run from a USB stick, or you can use the installer version.

And it’s FREE.

You can capture (mirror) several websites complete with their data, and they may be accessed from a master web-page; as in the example below.

The REALLY cool bit is that downloadable files such as PDFs and jpg files are saved too. If it’s in a directory and referenced by a regular page link, it will be downloaded.

Error reporting is also good. Use this on your own website to show up a list of any broken links – and other errors.

Let me know if you learn any neat tricks with this software…..

Richard Langner

 

 

 

 

 

 

Using the Boards Manager of the Adruino IDE

By Richard M Langner

In order to program an Arduino device (a board or a stand-alone chip), it needs to be listed in the Arduino IDE. If it isn’t listed, this article should help you list it using the Boards Manager. The basic procedure is –

  1. Locate the Boards Manager URL for your device (search the web).
  2. Add it to the ‘Additional Boards Manager URLs’ list (under File → Preferences).
  3. Install the device in the ‘Boards Manager’ (under Tools).

I am using the Arduino IDE v1.6.7 and the device I want to list is the ATtiny85 stand-alone 8 pin chip. Boards/devices are listed in alphabetical order and you can see below that no ATtinys are listed.
(Click to enlarge the images)

not-on-the-board-list

First, we need to find a board manager for our device. A search for ‘ATtiny85 board manager’ brings up a couple of candidates.

search-results

Click on the top result and copy the ‘Boards Manager URL’ to the clipboard.

copy-json-link

This URL needs to be added to the ‘Additional Boards Manager URLs’ which you will find under File → Preferences.

file-preferences

In Preferences, click on the button to see a list of board managers that are already installed.

preferences

In my case there are only two managers installed

already-installed-managers

Paste the URL (you previously copied) into the list on a new line and click OK. Then close these boxes and return to the IDE main screen.

paste-the-url

You have just told the boards manager where to look for the information.

Now you can begin to install the manager for the ATtiny85.  Find your way to the Boards Manager –

board-manager-1

and type ‘ATtiny’ into the search-box. You should get something like this –

board-manager-2

Click on the appropriate manager item and an Install button appears.

board-manager-3

Click on the Install button and after a moment you will see confirmation the manager has been installed.

board-manager-4

The ATtiny devices will now show up in the list of boards/devices.

board-list

Finally, select the ATtiny85 device and ensure that all the other settings are correct.

chip-settings

You are now ready to program the ATtiny85.

The same procedure may be used to install other boards/devices into the Arduino IDE.

Note: Your screens and menu options may be slightly different to mine, but the general method of listing your device should be the same.

Programming the ATtiny85 using an Arduino UNO

By Richard M Langner

This article describes how you can use an Arduino UNO to program a bare ATtiny85 micro-controller chip. I will show you how to program the ATtiny85 with the ‘Blink’ sketch. These are the steps –

  1. Connect the UNO to the ATtiny breadboard and connect the 10uF capacitor
  2. Configure the Arduino as an In-circuit Serial Programmer (ISP)
  3. Insert the ATtiny85 into the breadboard
  4. Configure the IDE for the ATtiny85
  5. Modify and upload the ‘blink’ sketch to the ATtiny85

1. Connect the UNO to the ATtiny85 breadboard and connect the 10uF capacitor
Connect the UNO to the breadboard as shown below. If you intended to keep the breadboard and UNO solely for programming, I recommend using an 8 pin socket for the ATtiny85 – this will ensure you insert the chip in the correct place each time on the breadboard.
Don’t insert the ATtiny85 in the socket yet – you must first configure the UNO to act as a programmer.

Pin connections:

  • ATtiny Pin 2 to Arduino Pin 13
  • ATtiny Pin 1 to Arduino Pin 12
  • ATtiny Pin 0 to Arduino Pin 11
  • ATtiny Reset Pin to Arduino Pin 10
  • ATtiny Pin 2 to 150Ω resistor, resistor to LED anode, LED cathode to GND (not shown here).
  • 10uF capacitor connects between GND (-) and RESET (+)

(Click on the images to get a clearer image.)

Uno as an ISP

2. Configure the Arduino as an In-circuit Serial Programmer (ISP)

Select the Arduino UNO board
setup-isp-1

and open the ISP sketch.
isp

Next you should upload the ISP example to the UNO board. Ensure you have selected the correct COM port.
download-blink

Congratulations! Your UNO is configured as a programmer.

You’re now ready to program the ATtiny85 with the ‘Blink’ sketch. You will need to connect an LED to display the blink. Connect a 150 Ohm resistor to the physical pin2 on the chip. The other end of the resistor should connect to the LED anode (its long leg), and the LED cathode connects to GND.

3. Insert the ATtiny85 into the breadboard

Remove the power by unplugging the USB cable. Taking care, insert the ATtiny chip into the breadboard socket the correct way around. Re-connect the USB cable.

4. Configure the IDE for the ATtiny85

Configure the IDE as follows –

  • Board  =  ATtiny85
  • Processor  =  ATtiny85
  • Clock speed  =  8MHz

2016-10-01_00037 2016-10-01_00038

Set the programmer ‘Arduino as ISP’
2016-10-01_00039

If the ATtiny85 is new, it will require the fuses to be set.  Among other things, fuses set the CPU speed. The fuses only need to be set once for each chip. To do this, select the ‘Burn bootloader’ option.

2016-10-01_00040

5. Modify and upload the ‘blink’ sketch to the ATtiny85

Open the example sketch ‘Blink’ and change the LED’s digital pin number to 3 on all the sketch lines (this is because the ATtiny85 does not have a pin13. Note that physical pin2 on the chip is digital pin3 on the ATtiny85). The code should look like this –

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 3 as an output.
  pinMode(3, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(3, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(3, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second
}

Finally upload the ‘Blink’ sketch to the ATtiny85.
download-blink

That’s it! The blink program should now flash the LED.

The UNO is now set up as a programmer and so further ATtiny85 chips may be programmed by simply plugging them into the breadboard and uploading your code to them.

Richard Langner
With thanks to OJ for his help in defining the procedure.
This is my first post here, so please let me know if there is anything missing or incorrect.