Skip to content

Instantly share code, notes, and snippets.

@vsquared
vsquared / TFTPushBtns_resistive
Created February 10, 2024 21:33
PushButtonGrid for Resistive TFT LCD
/*
* ON/OFF TFT Push Button Grid
* Each button is assigned to a digital output, which
* may be used to illuminate an LED (or other purpose).
* Two additional btns are used to turn all LED on or off.
* Boolean state of each button coincides with HIGH or LOW.
* For use with Adafruit 2.8" TFT LCD - resistive.
* Any of the four screen rotations may be used.
* LED resistors are 220 ohm.
*/
@vsquared
vsquared / MotorShield_UNO_TFT
Last active February 20, 2023 16:37
Source code to accompany U-Tube video "MotorShield_UNO_2.8"TFT_cap". url https://www.youtube.com/watch?v=5_bqeOZStr0
/*
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
@vsquared
vsquared / ECG_Olimex_v2
Last active November 8, 2017 06:38
Arduino sketch to accompany the video "UNO OlimexEKG TFT"
//*** ECG displayed on Adafruit 2.8" LCD v.2 using Arduino UNO board **** //
// ************************************************************** //
// * This source code is provided by the author "AS IS", * //
// * without warranty of any kind, either express or implied. * //
// ************************************************************** //
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
@vsquared
vsquared / CocoaWnd_C++
Last active July 30, 2017 17:39
The following source code runs in MacOS (10.12.3) and demonstrates building a cocoa window from a c++ class which contains objc code. A .mm file name extension is necessary to compile an objc/c++ hybrid, e.g. WndClass.mm. It may be compiled/run in Terminal (see below). An application bundle may be manually built or created by running in Xcode.
// compile in Terminal
// $ clang WndClass.mm -framework AppKit -o guiPlus
// run in Terminal
// $ ./guiPlus
#include <AppKit/AppKit.h>
NSTextView *txtView;
//prints formatted NSString with line feed
@vsquared
vsquared / TFTPushButtons.ino
Created June 4, 2017 04:34
Arduino sketch to accompany video "TFT PushButtons with LEDs"
/*
* ON/OFF TFT Push Button Grid
* Each button is assigned to a digital output, which
* may be used to illuminate an LED (or other purpose).
* Two additional btns are used to turn all LED on or off.
* Boolean state of each button coincides with HIGH or LOW.
* For use with Adafruit 2.8" TFT LCD - capacitive.
* Any of the four screen rotations may be used.
* LED resistors are 220 ohm.
*/
@vsquared
vsquared / ECG_dfrobot.ino
Last active March 15, 2017 08:26
Arduino sketch to accompany video, ECG_dfrobot.
/*
* DFRobot Heart Rate Monitor v1.0 (Gravity) with Arduino UNO
* to display electrocardiogram on Adafruit 2.8" TFT LCD shield (resistive).
* Screen height (landscape) is 240 pixels. Output numbers are too large
* to fit on screen, therefore sensorValue is divided by two or more.
* Graph origin is normally left,top and must be relocated to left,bottom.
* YOffset moves origin and helps position trace on screen; the larger the sensorValue,
* the larger YOffset must be in order to display ECG in center of screen.
* For larger trace size it is usually greater than tft.height().
*/