element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Problem with Firmata in Processing
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 1 reply
  • Subscribers 391 subscribers
  • Views 242 views
  • Users 0 members are here
  • frontpage
  • sensor processing
Related

Problem with Firmata in Processing

Former Member
Former Member over 9 years ago

Hello!

Why it does not work? I put piezo sensors into Arduino, and using Firmata as a way to connect processing. However, it does not work.

What I want is when I click the sensor, and a circle will appear.

 

 

Here is my code:

import org.firmata.*; import cc.arduino.*; import processing.serial.*; Arduino arduino;

 

 

int s1 = 7;//(r) //sensor1 int s2 = 8;//(y) //sensor2 int s3 = 9;//(b) //sensor3 int s4 = 10;//(g)//sensor4 int s5 = 11;//(b)//sensor5

 

 

void setup() { size(500, 500); background(255); println(Arduino.list());

 

 

arduino = new Arduino(this, Arduino.list()[4], 57600); arduino.pinMode(s1, Arduino.INPUT); arduino.pinMode(s2, Arduino.INPUT); arduino.pinMode(s3, Arduino.INPUT); arduino.pinMode(s4, Arduino.INPUT); arduino.pinMode(s5, Arduino.INPUT); } void draw() { if (arduino.digitalWrite(s1, Arduino.LOW)) {   ellipse(50, 50, 50, 50); } }

  • Sign in to reply
  • Cancel
  • Robert Peter Oakes
    Robert Peter Oakes over 9 years ago

    Have you verified that simply switching the input with a button or wire short will trigger it, perhaps the piezo is not generating a long or strong enough signal to be detected?, you may need to use an analogue channel and a comparator to generate an interrupt ?

     

    second observation is you're using a digital write where i would expect a read "if (arduino.digitalWrite(s1, Arduino.LOW))", if this is your piezo then you need to read and compare to Arduino.LOW "void draw() {if (arduino.digitalRead(s1)== Arduino.LOW)"{   ellipse(50, 50, 50, 50); } }", though I would expect it also should be comparing to Arduino.HIGH but this depends on how you have it wired.

     

    I don't use processing so my code may be slightly off but you get the idea

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube