Python Forum
Alicat Flow Meter data acquisition
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Alicat Flow Meter data acquisition
#1
Hi everybody.

I have this code that I use to graph and acquire temperature data from three thermocouples using nidaqmx:

import nidaqmx
import matplotlib.pyplot as plt

plt.ion()

i=0

with nidaqmx.Task() as task:
    task.ai_channels.add_ai_thrmcpl_chan("Dev1/ai0:2")
    while i<50:
        data = task.read(number_of_samples_per_channel=1)
        plt.scatter(i,data[0],c='r')
        plt.scatter(i,data[1],c='b')
        plt.scatter(i,data[2],c='y')
        plt.pause(1)
        i=i+1
        print (data)
Now I need to graph and acquire data from an Alicat Flow meter in the same way that the previouos code, so I tried this:

import asyncio
import matplotlib.pyplot as plt
from alicat import FlowMeter

plt.ion()

i=0

with asyncio.Task() as task:
    async def get():
        while i<50:
            data2 = task.read(FlowMeter("COM3:A"))
            plt.scatter(i,data2,c='r')
            plt.pause(1)
            i=i+1
            print(await data2.get())

asyncio.run(get())
This is the error code I get:
Error:
Traceback (most recent call last): File "C:\Users\marenr\My Documents\LiClipse Workspace5\thermocouple data acquisition\Data_acquisition.py", line 9, in <module> with asyncio.Task() as task: ^^^^^^^^^^^^^^ TypeError: Task() missing required argument 'coro' (pos 1)
I would really appreciate on suggestions on how I would need to update my code to be able to plot and acquire data from the flow meter. I believe the main problem I had is that in the latter code I didn´t know how to deal with the asyncio.

I´m using window 10 pro

Thanks in advance.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Node Flow Generation in Python Linenloid 0 658 Feb-21-2023, 07:09 PM
Last Post: Linenloid
  Flow Control Help RoadToSensei 5 1,702 Feb-14-2022, 08:21 PM
Last Post: deanhystad
  Understanding Raspberry PI RTS/CTS flow control zazas321 2 3,647 Oct-30-2020, 09:55 AM
Last Post: zazas321
  Understanding Raspberry PI RTS/CTS flow control zazas321 0 1,510 Oct-30-2020, 08:02 AM
Last Post: zazas321
  Reproducing assignment with min cost flow in networkx mntfr 0 2,137 Jun-13-2019, 04:06 PM
Last Post: mntfr
  Find Maximum Flow for graph with infinite capacities Dav 6 4,270 Apr-16-2019, 02:08 PM
Last Post: Dav
  Sound Meter dcanogi 2 3,221 Feb-07-2019, 03:17 PM
Last Post: dcanogi
  error in python script (for energy meter) br0ken 9 6,612 Dec-01-2017, 02:31 PM
Last Post: br0ken
  program flow advice sampazzer 2 3,114 Aug-05-2017, 09:34 PM
Last Post: sampazzer
  Trouble with general code flow JCN 1 3,400 May-26-2017, 01:27 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020