This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "LPD8806.h" | |
#include "SPI.h" // Comment out this line if using Trinket or Gemma | |
#ifdef __AVR_ATtiny85__ | |
#include <avr/power.h> | |
#endif | |
// Example to control LPD8806-based RGB LED Modules in a strip | |
/*****************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Ultrasonic sensor Pins: | |
VCC: +5VDC | |
Trig : Trigger (INPUT) - Pin11 | |
Echo: Echo (OUTPUT) - Pin 12 | |
GND: GND | |
*/ | |
int trigPin = 11; // Trigger | |
int echoPin = 12; // Echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var song; | |
function setup() { | |
song = loadSound('assets/song.mp3'); | |
createCanvas(720, 200); | |
background(255,0,0); | |
} | |
function mousePressed() { | |
if ( song.isPlaying() ) { // .isPlaying() returns a boolean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char letter; | |
String sym = "AAPL"; | |
void setup(){ | |
} | |
void draw(){ | |
//In draw method | |
text("Current key: " + letter, 10, 40); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//button | |
fill(255,0,0); | |
rect(10,70,100,40); | |
fill(255,255,255); | |
words = words + letter;//add this to keyTyped | |
void keyPressed() { | |
if (keyCode == 32) { | |
words = ""; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void read(){ | |
String conn = "https://financialmodelingprep.com/api/company/profile/"; | |
conn = conn + sym; | |
String[] fd = loadStrings(conn);//save info to string array | |
fd[0] = trim(fd[0].substring(fd[0].indexOf("{")));//grab the part we need | |
for(int i=0; i<fd.length; i++){ | |
println(fd[i]);//make sure it works. | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//after the for loop add these lines to get the key information about the stock | |
JSONObject jarr = JSONObject.parse(lines); | |
JSONObject stock = jarr.getJSONObject(sym); | |
int price = stock.getInt("Price"); | |
String beta = stock.getString("Beta"); | |
String name = stock.getString("companyName"); | |
println(price + ", " + beta + ", " + name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String[] lines; | |
ArrayList<String> pnames = new ArrayList<String>(); | |
ArrayList<Integer> count = new ArrayList<Integer>(); | |
int x = 0; | |
int y = 380; | |
int size = 1; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.FilenameFilter; | |
int counter = 1; | |
int pn = 16;//number of puzzle pieces | |
PImage img; // Declare a variable of type PImage | |
PImage[][] pieceArray = new PImage[pn][pn];//array of images | |
int width = 800; | |
int height = 600; |
OlderNewer