Menu
Index
Engineering
Entertainment
Literature
Miscellaneous
Contact
Search
tiktok.com/@pkvi.xyz
buymeacoffee.com/pkvi
scored.co/u/pkvi_halfkdeltaxsq
Miter
Why Ayh?
Miter
@pkvi
"...may not meet professional standards."
319 miters
122 tenons
Subscribe
0.00135
Gate Jedi




Particle Photon Code
  1. // Gate Jedi
  2. // pkvi
  3. int sig = D7;
  4. int command = 0;
  5. void setup() {
  6. pinMode(sig, OUTPUT);
  7. Spark.function("gate",gateJedi);
  8. digitalWrite(sig, LOW);
  9. }
  10. void loop() {
  11. }
  12. int gateJedi(String command) {
  13. if (command=="open") {
  14. digitalWrite(sig,HIGH);
  15. delay(3000);
  16. digitalWrite(sig,LOW);
  17. command = 0;
  18. }
  19. else {
  20. digitalWrite(sig,LOW);
  21. }
  22. }

Pebble.js Gate Jedi APP
  1. // Gate Jedi Peddle APP (Version 1.3)
  2. // pkvi
  3. // Pebble Blink APP @Jack-Dangerfield
  4. var Accel = require('ui/accel');
  5. Accel.init();
  6. var UI = require('ui');
  7. var ajax = require('ajax');
  8. var Vector2 = require('vector2');
  9. // Create Window
  10. var main_window = new UI.Window();
  11. // Open Button and Display
  12. var txtOnLabel = new UI.Text({
  13. position: new Vector2(0, 50),
  14. size: new Vector2(144, 30),
  15. font: 'Gothic 28 Bold',
  16. text: 'GATE JEDI',
  17. textAlign: 'center',
  18. color: 'white'
  19. });
  20. // Display Main Window
  21. main_window.backgroundColor('black');
  22. main_window.add(txtOnLabel);
  23. main_window.show();
  24. // URL To Particle Cloud
  25. function Toggle(function_name,function_value){
  26. var URL = 'https://api.particle.io/v1/devices/DEVICE
  27. ID/' + function_name +'?access_token=TOKEN';
  28. ajax(
  29. {
  30. url: URL,
  31. method: 'post',
  32. type: 'json',
  33. data: { "args": function_value}
  34. }
  35. );
  36. }
  37. // Accelerometer Poll and Function (Default 100Hz 25)
  38. Accel.on('data', function(e) {
  39. console.log(e.accel.x);
  40. if (e.accel.x > 900) {
  41. console.log(e.accel.y);
  42. if (e.accel.y > 900) {
  43. Toggle('gate','open');
  44. }}
  45. });
  46. // Button Function and Photon Parameters
  47. main_window.on('click', 'up', function() {
  48. Toggle('gate','open');
  49. });